| .df_to_list_of_lists | R Documentation |
Convert a nested dataframe to a multilevel list
.df_to_list_of_lists(df, ...)
df |
a nested dataframe |
... |
Named arguments passed on to
|
a list of lists
iris_list = .df_to_list_of_lists(datasets::iris) # TODO: iris_list has lost Petal.Length as it is interpreting Petal.Width as # nested item and it overwrites Petal.Length rather than merging with it. testthat::expect_equal( iris_list[[1]]$Species, iris$Species[[1]] ) mtcars_nest = datasets::mtcars dplyr::mutate(name = rownames(.)) tidyr::nest(details = -c(cyl,gear)) mtcars_list = mtcars_nest mtcars_unnest = mtcars_list testthat::expect_equal( mtcars_list[[1]]$details[[1]]$name, mtcars_nest$details[[1]]$name[[1]] )
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.