'Rstudio how to compare columns in two dataframes for a match in multiple logical columns
I am wanting to load in dataframe from excel that has multiple logical columns, and search within another dataframe for anything that matches the logicals. I am not sure how exactly to do this, and have been racking my brain trying to figure out the best way. I am using RStudio
My first data set looks like this (df1)
Reason T A B C D E
<chr> <chr> <lgl> <lgl> <lgl> <lgl> <lgl>
1 Name1 A FALSE FALSE FALSE NA FALSE
2 Name2 A NA FALSE FALSE NA NA
3 Name3 A NA NA FALSE NA NA
4 Name4 B NA NA NA NA NA
5 Name5 B FALSE FALSE FALSE NA NA
6 Name6 A NA FALSE FALSE NA NA
Second data set looks like this (df2)
Number T A B C D E
<dbl> <chr> <lgl> <lgl> <lgl> <lgl> <lgl>
1 1 A FALSE FALSE FALSE TRUE TRUE
2 2 A TRUE FALSE FALSE FALSE FALSE
3 3 A TRUE TRUE FALSE TRUE TRUE
4 4 B TRUE TRUE TRUE TRUE TRUE
5 5 B FALSE FALSE FALSE TRUE TRUE
6 6 A FALSE FALSE FALSE TRUE FALSE
I would like it to filter by the negative requirement in the data frame, and give back a list that line 1 from df1 and line 6 from df2 are a match based on their logical columns
df1
1 Name1 A FALSE FALSE FALSE NA FALSE
df2
6 Name6 A NA FALSE FALSE NA NA
Any help will be much appreciated- thank you.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
