I would like to construct a dataframe row-by-row in R. I\'ve done some searching, and all I came up with is the suggestion to create an empty list, keep a list index scalar,
This is a silly example of how to use do.call(rbind,) on the output of Map() [which is similar to lapply()]
do.call(rbind,)
Map()
lapply()
> DF <- do.call(rbind,Map(function(x) data.frame(a=x,b=x+1),x=1:3)) > DF x y 1 1 2 2 2 3 3 3 4 > class(DF) [1] "data.frame"
I use this construct quite often.