Hi everyone,
Supposing I have two data frames, such as this:
a <- c(10,20,30,40)
b <- c('book', 'pen', 'textbook', 'pencil_case')
c <- c(TRUE,FALSE,TRUE,FALSE)
d <- c(2.5, 8, 10, 7)
e <- c(2.4, 5, 10, 7)
df1<-data.frame(a,b,c)
df2<-data.frame(b,c,d,e)
Is there a function that will create a new data frame combining the df1 and df2 where it automatically detects columns that overlap, combines them, but then leaves the unique ones (in this case, just e) in the data frame as well?
Important! I know you can do this via the merge function where you pass the overlapping column names into the "by" argument, but it can be a bit tiresome and error proof to manually input all the overlapping columns when there are many of them!
Thanks in advance :).