rbind does not check for column names when binding together vectors:
l = list(row1 = c(10, 20), row2 = c(20, 10))
names(l$row1) = c(\"A\", \"B\")
names(l$row
Reduce is a powerful function, but some how not frequently used ; here's an alternate implementation
This will create a rbind where if there are columns that don't match "NA" will be generated for them.
rbindedFrame = Reduce(custom_rbind,listofDataframes)
custom_rbind = function(x1,x2){
c1 = setdiff(colnames(x1),colnames(x2))
c2 = setdiff(colnames(x2),colnames(x1))
for(c in c2){##Adding missing columns from 2 in 1
x1[[c]]=NA
}
for(c in c1){##Similiarly ading missing from 1 in 2
x2[[c]]=NA
}
x2 = x2[colnames(x1)]
rbind(x1,x2)
}
}