0

I have two data frames df1 and df2. I want to append all the rows of df2 into df1 in their respective columns. See the desired output.

df1<-data.frame("Marks 1"= c(1,2), "Marks 2"=c(5,6),"Marks 3"=c(1,2),"Marks 4"=c(7,8))
df2<-data.frame("Marks 2"= c(7,8), "Marks 3"=c(3,4))

Desired Output

1 Answers1

0

Are you looking for this?

library(dplyr)
df1<-data.frame("Marks 1"= c(1,2), "Marks 2"=c(5,6),"Marks 3"=c(1,2),"Marks 4"=c(7,8))
df2<-data.frame("Marks 2"= c(7,8), "Marks 3"=c(3,4))

full_join(df1, df2) # option 1

bind_rows(df1, df2) # option 2
yarnabrina
  • 1,561
  • 1
  • 10
  • 30