简体   繁体   中英

Can I use join with across from dplyr?

I do not want to use all variables in data frame. I was thinking of something like this, but it comes up with an error.

df1 %>% 
full_join(df2, by = 'DATE':'Vz').

Both data frame contain the same variables from DATE to Vz. I am interested in bringing the non-zero values of df2 to df1.

Thank you.

You can join by multiple columns with dplyr. Let me know if this answers your question:

library(dplyr)

full_join(df1, df2, 
  by=colnames(d1)[which(colnames(df1)=="DATE"):which(colnames(df1)=="Vz")])

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM