# NOT RUN {
df1 <- data.frame(A = 1:10, B = LETTERS[1:10], C = rnorm(10))
df2 <- data.frame(A = 11:20, D = rnorm(10), E = letters[1:10])
# rbind would fail
# }
# NOT RUN {
rbind(df1, df2)
# Error in match.names(clabs, names(xi)) : names do not match previous
# names:
# D, E
# }
# NOT RUN {
# but smartbind combines them, appropriately creating NA entries
smartbind(df1, df2)
# specify fill=0 to put 0 into the missing row entries
smartbind(df1, df2, fill = 0)
# }
# NOT RUN {
# }
Run the code above in your browser using DataLab