Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

df_arrange

Arrange Rows by Column Values


Description

Order the rows of a data frame by values of specified columns. Wrapper arround the arrange() function. Supports standard and non standard evaluation.

Usage

df_arrange(data, ..., vars = NULL, .by_group = FALSE)

Arguments

data

a data frame

...

One or more unquoted expressions (or variable names) separated by commas. Used to select a variable of interest. Use desc() to sort a variable in descending order.

vars

a character vector containing the variable names of interest.

.by_group

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

Value

a data frame

Examples

df <- head(ToothGrowth)
df

# Select column using standard evaluation
df %>% df_arrange(vars = c("dose", "len"))

# Select column using non-standard evaluation
df %>% df_arrange(dose, desc(len))

rstatix

Pipe-Friendly Framework for Basic Statistical Tests

v0.7.0
GPL-2
Authors
Alboukadel Kassambara [aut, cre]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.