Apologies in advance if this is a duplicate question, but I can't find anything on this in the stack overflow archives.
I wrote a function that returns a zoo object (makeTrace1). In a second function (make2DHist), I call this function many times and so generate a list of dataframes (converted from the returned zoo objects). I would then like to rbind all these dataframes in my list together. I can rbind specific elements together so I could do this with a for loop, but is there a vectorized expression to rbind all the dataframes in the list together?
Here's my code:
make2DHist <- function() { v = list() times=4 for(i in 1:times) { vv = makeTrace1() v[[i]] = data.frame(Date=time(vv), vv, check.names = FALSE, row.names=NULL) } hhh = rbind(v[[1]], v[[2]]) <-----this works hhh2 = rbind(v[c(1:4)]) <-this does not work } m= make2DHist()
do.call("rbind", lst)or using thedata.tablepackagerbindlist(lst)