Learn R Programming

tidytable (version 0.8.0)

arrange.: Arrange/reorder rows

Description

Order rows in ascending or descending order.

Note: data.table orders character columns slightly differently than dplyr::arrange() by ordering in the "C-locale". See ?data.table::setorder for more details.

Usage

arrange.(.df, ...)

Arguments

.df

A data.frame or data.table

...

Variables to arrange by

Examples

Run this code
df <- data.table(
  a = 1:3,
  b = 4:6,
  c = c("a", "a", "b")
)

df %>%
  arrange.(c, -a)

df %>%
  arrange.(c, desc(a))

Run the code above in your browser using DataLab