fasten | R Documentation |
Roll up a list
of arbitrary depth with data.frame
's at the leaves row-wise.
fasten( list, into = NULL, depth = 0 )
list |
A |
into |
A |
depth |
Depth to bind the list to. Defaults to 0. |
Use empty strings ""
in the into
argument to omit column creation when rows are binded. Use positive integers for the depth
to move from the root and negative integers to move from the leaves. The maximum (minimum) depth will be used for integers larger (smaller) than such. The leaves of the input list
should be at the same depth.
A tibble::tibble
or reduced list
Alex Zajichek
#Make a divided data frame list <- heart_disease %>% divide( Sex, HeartDisease, ChestPain ) #Bind without creating names list %>% fasten #Bind with names list %>% fasten( into = c("Sex", "HeartDisease", "ChestPain") ) #Only retain "Sex" list %>% fasten( into = "Sex" ) #Only retain "HeartDisease" list %>% fasten( into = c("", "HeartDisease") ) #Bind up to Sex list %>% fasten( into = c("HeartDisease", "ChestPain"), depth = 1 ) #Same thing, but start at the leaves list %>% fasten( into = c("HeartDisease", "ChestPain"), depth = -2 ) #Too large of depth returns original list list %>% fasten( depth = 100 ) #Too small of depth goes to 0 list %>% fasten( depth = -100 )
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.