I have two data frames that have some columns with the same names and others with different names. The data frames look something like this:
df1
ID hel
@ananda-mahto 's answer is more elegant but here is my suggestion:
library(reshape2)
df1=melt(df1,id='ID',na.rm=TRUE)
df2=melt(df2,id='ID',na.rm=TRUE)
DF=rbind(df1,df2)
# Not needeed, added na.rm=TRUE based on @ananda-mahto's valid comment
# DF<-DF[!is.na(DF$value),]
dcast(DF,ID~variable,value.var='value')