I have code that at one place ends up with a list of data frames which I really want to convert to a single big data frame.
I got some pointers from an earlier ques
The only thing that the solutions with data.table
are missing is the identifier column to know from which dataframe in the list the data is coming from.
Something like this:
df_id <- data.table::rbindlist(listOfDataFrames, idcol = TRUE)
The idcol
parameter adds a column (.id
) identifying the origin of the dataframe contained in the list. The result would look to something like this:
.id a b c
1 u -0.05315128 -1.31975849
1 b -1.00404849 1.15257952
1 y 1.17478229 -0.91043925
1 q -1.65488899 0.05846295
1 c -1.43730524 0.95245909
1 b 0.56434313 0.93813197