This is a really simple question, but can't find a suitable answer here.
How does one join two data.frames with
dplyr based on two columns with different names in each data.frame?
base::merge one can simply
df3 <- merge(df1, df2, by.x=c("name1", "name2"), by.y=c("name3", "name4"))
df1$name1 == df2$name3 and
df1$name2 == df2$name4.
How does one do this in
I know that one can use the
by function in
dplyr to do join two data.frames with based on one column with a different name:
df3 <- dplyr::left_join(df1, df2, by=c("name1" = "name3"))