list check in R

Hi R community

i have 4 tables with rules each containing an ID and a name, like this:


i have another list with ID that i need to run through this df so that if there is a match it gives me that as output. if there is no match it goes to te next list (with ID and name again) and check if there is a match in that table

use dplyr inner join to find where two data.frames match
example:

library(dplyr)
band_members
band_instruments
(match_df <- inner_join(band_members,
                        band_instruments))

match_df <- inner_join(non_Trade,sampleCus)
Error: by must be supplied when x and y have no common variables.
i use by = character()` to perform a cross-join.

the two df does not have same dimensions and i need to run it through multiple of df's - so if there is no match in the first matching then it should continue to the next df and check if there is a match

I think there are two separable issues.

  1. common fields existing between two df through which matching is attempted.
    In my example band_members and band_instruments both had name field in common.
    you indicated both your df's would contain ID and name fields, is this perhaps not the case ?
  2. to process (many) multiple data.frames you should use some form of iteration, I typically reach for purrr::map style functions. are your multiple data.frames easily referenceable ? if they each have wildly differing names, do you have a source for the names of the data.frames to operate on ?

Hi Nirgrahamuk

sry, for the late return, sounds to me like solution 2 is the better one. Let me elaborate a bit. So i got this df with job ID's that i need to check for:

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.