Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8938397
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T10:36:57+00:00 2026-06-15T10:36:57+00:00

I have been looking at mapply documentation but I cannot find an example close

  • 0

I have been looking at mapply documentation but I cannot find an example close enough to help me get started.

I have lists foo and bar:

set.seed(123)
f   <- data.frame(y=1:10,x=sample(LETTERS,10))
foo <- list(f,f)
b   <- data.frame(x=c("J","U","A"))
ba  <- data.frame(x=c("J","W"))
bar <- list(b,ba)

I can subset f with b using:

result <- f[f$x %in% b$x ,]

I want to do this subset but for the whole lists foo and bar i.e. subset foo[[1]] by foo[[1]]["x"] on bar[[1]] and foo[[2]] by foo[[2]]["x"] on bar[[2]] etc…

the result would be:

>foo
[[1]]
    y x
3   3 J
4   4 U
6   6 A

[[2]]
    y x
3   3 J
5   5 W
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T10:36:58+00:00Added an answer on June 15, 2026 at 10:36 am

    Like so…?

    mapply(merge,foo,bar,SIMPLIFY = FALSE)
    [[1]]
      x y
    1 A 6
    2 J 3
    3 U 4
    
    [[2]]
      x y
    1 J 3
    2 W 5
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been looking for the error for a long time, but cannot find
I have been looking online to find documentation for the function in QTP and
I have been looking everywhere but could not find a tutorial for this. I
I have been looking around online to try to find a complete solution but
I have been looking up about LocalStorage, however I cannot seem to find an
I have been looking over the internet, but could not find the perfect tutorial
I have been looking through the archives but can't find a solution that works,
I have been looking everywhere but I cannot seem to google it right so
Have been looking on some tutorials for drawing canvas using SurfaceView, but the only
I have been looking for an answer to this on Stack Overflow, but I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.