nest_arrange {nplyr} | R Documentation |
Arrange rows within a nested data frames by column values
Description
nest_arrange()
orders the rows of nested data frames by the values of
selected columns.
Usage
nest_arrange(.data, .nest_data, ..., .by_group = FALSE)
Arguments
.data |
A data frame, data frame extension (e.g., a tibble), or a lazy data frame (e.g., from dbplyr or dtplyr). |
.nest_data |
A list-column containing data frames |
... |
Variables, or functions of variables. Use |
.by_group |
If |
Details
nest_arrange()
is largely a wrapper for dplyr::arrange()
and maintains
the functionality of arrange()
within each nested data frame. For more
information on arrange()
, please refer to the documentation in
dplyr
.
Value
An object of the same type as .data
. Each object in the column .nest_data
will be also of the same type as the input. Each object in .nest_data
has
the following properties:
All rows appear in the output, but (usually) in a different place.
Columns are not modified.
Groups are not modified.
Data frame attributes are preserved.
See Also
Other single table verbs:
nest_filter()
,
nest_mutate()
,
nest_rename()
,
nest_select()
,
nest_slice()
,
nest_summarise()
Examples
gm_nest <- gapminder::gapminder %>% tidyr::nest(country_data = -continent)
gm_nest %>%
nest_arrange(country_data, pop)
gm_nest %>%
nest_arrange(country_data, desc(pop))