search for: listoflists

Displaying 1 result from an estimated 1 matches for "listoflists".

Did you mean: list_lists
2003 Sep 22
1
Data frame from list of lists
...uding character. I want to apply it to many inputs, resulting in a list of lists. I would like to turn this list of lists into a single data frame in which each row corresponds to one of the original sublists. Here is a toy example: myfunc=function(x) return(list(A=x,L=letters[x],T=Sys.time())) ListOfLists=lapply(1:4,myfunc) ListOfDataFrames=lapply(ListOfLists,as.data.frame) df=do.call("rbind",ListOfDataFrames) df Which gives: A L T 1 1 a 2003-09-22 02:08:44 11 2 b 2003-09-22 02:08:44 12 3 c 2003-09-22 02:08:44 13 4 d 2003-09-22 02:08:44 Which is what I want (bar t...