| .transpose | R Documentation |
Data frames are column lists, which may have nested dataframes. This function
transforms a data frame to row based list with named sub lists with one entry
per dataframe column (a row_list). It alternative converts a row_list back
to a nested data frame
.transpose(x, ..., .fix = ".")
x |
a |
... |
not used |
.fix |
collapse or expand names in redundant multi-level |
either a dataframe or a list of class row_list representing the
dataframe as a list of named lists.
# create a test nested data frame: mtcars_nest = datasets::mtcars dplyr::mutate(name = rownames(.)) tidyr::nest(by_carb = -c(cyl,gear,carb)) tidyr::nest(by_cyl_and_gear = -c(cyl,gear)) mtcars_list = mtcars_nest mtcars_nest2 = mtcars_list testthat::expect_equal(mtcars_nest, mtcars_nest2)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.