combine_df {mcstatsim} | R Documentation |
Combine Dataframes in a Nested List
Description
This function combines dataframes that are nested within a list of lists into a single dataframe.
Usage
combine_df(nested_list)
Arguments
nested_list |
A list of lists, where each sublist contains dataframes to be combined. |
Details
The function first checks if the input is a non-empty list of lists containing dataframes. It then iterates through each sublist, combining the dataframes and adding an ID column to indicate their source. Finally, all combined dataframes are row-bound into a single dataframe.
Value
A combined dataframe where each original dataframe is augmented with an ID column indicating its source list.
Examples
df1 <- data.frame(a = 1:3, b = 4:6)
df2 <- data.frame(a = 7:9, b = 10:12)
nested_list <- list(list(df1, df2), list(df1, df2))
combine_df(nested_list)
[Package mcstatsim version 0.5.0 Index]