I want to use smartbind() to merge 20+ dataframes. These data frames have different number of observations (rows). Most of their columns have the same names though some differ. I have named them like this:
data.Argentina
data.Brazil
data.Venezuela
Then, I wrote
library(gtools)
combined.data <- smartbind(mget(ls(pattern = "^data.")))
The error information is :
Error in data.frame(data.Argentina = list(pais = c(1L, 1L, 1L, 1L, 1L, : arguments imply differing number of rows: 1512, 3429, 1533, 3067, 1500, 1571, 1510, 1537, 1520, 1489, 1507, 1557, 1561, 1503, 1535, 1546, 1508, 4000, 4203
Then, I have to do it by manually listing all data frames:
combined.data <- smartbind (data.Argentina, data.Brazil, data.Venezuela)
This time it works!
So could I use other functions or other commands to make the process simpler?
Thank you!