I have 2 data frames with different number of columns each. Some of the columns are common between the 2 data frames. How can i rbind only the common columns of the two data
Here is my solution hope i got your question right
df1 <- data.frame(a=rnorm(100), b=rnorm(100), not=rnorm(100)) df2 <- data.frame(a=rnorm(100), b=rnorm(100)) bind1 <- bind1 <- df1[, names(df1) %in% names(df2)] bind2 <- bind1 <- df1[, names(df2) %in% names(df1)] rbind(bind1, bind2)