Andrew Sannier Andrew Sannier - 1 month ago 5
R Question

Split a dataframe into a list of dataframes, but how to re-merge?

I have a big ol' data frame with two ID columns for courses and users, and I needed to split it into one dataframe per course to do some further analysis/subsetting. After eliminating quite a few rows from each of the individual course dataframes, I'll need to stick them back together.

I split it up using, you guessed it,

, and that worked exactly as I needed it to. However, unsplitting was harder than I thought. The R documentation says that "
reverses the effect of
," but my reading on the web so far is suggesting that that is not the case when the elements of the split-out list are themselves dataframes.

What can I do to rejoin my modified dfs?


This is a place for Simply calling df <- rbind(split.df) will result in a weird and useless list object, but"rbind", split.df) should give you the result you're looking for.