arrange_data: Arrange rows

Description Usage Arguments Value Examples

View source: R/arrange.R

Description

Arrange rows via descending or ascending column values

Usage

1
arrange_data(.data, ...)

Arguments

.data

data frame

...

One or more unquoted names of columns on which to arrange the rows. If none are supplied, the data are returned as is. By default, ordering is done in ascending order. To orer in descending order, use decr on desired variable(s).

Value

Rearranged data frame

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
## data frame to arrange
dat <- data.frame(
  a = c(rep("a", 3), rep("b", 3), rep("c", 4)),
  b = c( 3, 3, 2,     8, 8, 1,     5,  5, 5, 9),
  c = c(-1, 0, 0,    -5, 0, 2,    -2, -4, 1, 0),
  stringsAsFactors = FALSE
)

## arrange by one column
arrange_data(dat, a)

## arrange by multiple columns
arrange_data(dat, decr(a), b, c)

tbltools documentation built on Feb. 9, 2019, 1:04 a.m.