Reputation: 83
I have a list (res) containing p x b number of dataframes. Each dataframe has 12 columns but varying number of rows (e.g, res[[1]][[1]]
has 12 cols and 36 rows, but res[[1]][[1]]
has 12 cols and 38 rows).
I would like to combine them into a single dataframe that has 12 columns and 179 rows let's say.
Thedo.call("rbind", listOfDataFrames)
method doesn't work as I loose column and row information. Let me know, if further specification is needed.
Many thanks!
Upvotes: 2
Views: 3858
Reputation: 31161
In fact it is a list containing 5
elements. And the first element is a list of dataframes, whereas the other elements 2
, 3
, 4
and 5
are NULL
. so you need to do access the first element of your list:
do.call(rbind, listOfDataFrames[[1]])
Or:
rbindlist(listOfDataFrames[[1]])
Upvotes: 6