Description Usage Arguments Examples
See tidyr::nest()
for additional documentation
1 |
data |
A data frame. |
... |
A selection of columns. If empty, all variables are selected. You
can supply bare variable names, select all variables between x and z with
'x:z', exclude y with '-y'. For more options, see the
|
.key |
The name of the new column, as a string or symbol. |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | #Nest a column with a list column already present
library(tidyr)
library(dplyr)
library(tibble)
as_tibble(iris) %>%
rowid_to_column("rowid") %>%
nest2(starts_with("Sepal"), .key = "Sepal") %>%
nest2(starts_with("Petal"), .key = "Petal")
#This does not work with tidyr::nest()
## Not run:
as_tibble(iris) %>%
rowid_to_column("rowid") %>%
nest(starts_with("Sepal"), .key = "Sepal") %>%
nest(starts_with("Petal"), .key = "Petal")
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.