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 dplyr::desc() to sort a variable in descending order.

.by_group

If TRUE, will sort first by grouping variable. Applies to grouped data frames only.

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:

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))

[Package nplyr version 0.2.0 Index]