| nest.dtplyr_step {dtplyr} | R Documentation |
Nest
Description
This is a method for the tidyr tidyr::nest() generic. It is translated
using the non-nested variables in the by argument and .SD in the j
argument.
Usage
## S3 method for class 'dtplyr_step'
nest(.data, ..., .names_sep = NULL, .key = deprecated())
Arguments
.data |
A data frame.
|
... |
<tidy-select> Columns to nest, specified
using name-variable pairs of the form new_col = c(col1, col2, col3).
The right hand side can be any valid tidy select expression.
|
.names_sep |
If NULL, the default, the names will be left
as is. In nest(), inner names will come from the former outer names;
in unnest(), the new outer names will come from the inner names.
If a string, the inner and outer names will be used together. In
unnest(), the names of the new outer columns will be formed by pasting
together the outer and the inner column names, separated by names_sep. In
nest(), the new inner names will have the outer names + names_sep
automatically stripped. This makes names_sep roughly symmetric between
nesting and unnesting.
|
.key |
Not supported.
|
data |
A lazy_dt().
|
Examples
if (require("tidyr", quietly = TRUE)) {
dt <- lazy_dt(tibble(x = c(1, 2, 1), y = c("a", "a", "b")))
dt %>% nest(data = y)
dt %>% dplyr::group_by(x) %>% nest()
}
[Package
dtplyr version 1.2.2
Index]