arrange_all: Arrange rows by a selection of variables

View source: R/colwise-arrange.R

arrange_allR Documentation

Arrange rows by a selection of variables



Scoped verbs (⁠_if⁠, ⁠_at⁠, ⁠_all⁠) have been superseded by the use of pick() or across() in an existing verb. See vignette("colwise") for details.

These scoped variants of arrange() sort a data frame by a selection of variables. Like arrange(), you can modify the variables before ordering with the .funs argument.


arrange_all(.tbl, .funs = list(), ..., .by_group = FALSE, .locale = NULL)

arrange_at(.tbl, .vars, .funs = list(), ..., .by_group = FALSE, .locale = NULL)

  .funs = list(),
  .by_group = FALSE,
  .locale = NULL



A tbl object.


A function fun, a quosure style lambda ~ fun(.) or a list of either form.


Additional arguments for the function calls in .funs. These are evaluated only once, with tidy dots support.


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


The locale to sort character vectors in.

  • If NULL, the default, uses the "C" locale unless the dplyr.legacy_locale global option escape hatch is active. See the dplyr-locale help page for more details.

  • If a single string from stringi::stri_locale_list() is supplied, then this will be used as the locale to sort with. For example, "en" will sort with the American English locale. This requires the stringi package.

  • If "C" is supplied, then character vectors will always be sorted in the C locale. This does not require stringi and is often much faster than supplying a locale identifier.

The C locale is not the same as English locales, such as "en", particularly when it comes to data containing a mix of upper and lower case letters. This is explained in more detail on the locale help page under the ⁠Default locale⁠ section.


A list of columns generated by vars(), a character vector of column names, a numeric vector of column positions, or NULL.


A predicate function to be applied to the columns or a logical vector. The variables for which .predicate is or returns TRUE are selected. This argument is passed to rlang::as_function() and thus supports quosure-style lambda functions and strings representing function names.

Grouping variables

The grouping variables that are part of the selection participate in the sorting of the data frame.


df <- as_tibble(mtcars)
# ->
arrange(df, pick(everything()))

arrange_all(df, desc)
# ->
arrange(df, across(everything(), desc))

dplyr documentation built on Sept. 3, 2023, 5:08 p.m.