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, split
, and that worked exactly as I needed it to. However, unsplitting was harder than I thought. The R documentation says that "unsplit
reverses the effect of split
," 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 do.call
. Simply calling df <- rbind(split.df)
will result in a weird and useless list object, but do.call("rbind", split.df)
should give you the result you're looking for.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With