by-order: Ordering (sorting) rows of a data frame

Description Usage Arguments Details Value Author(s) See Also Examples

Description

Ordering (sorting) rows of a data frame by the certain variables in the data frame. This function is essentially a wrapper for the order() function - the important difference being that variables to order by can be given by a model formula.

Usage

1

Arguments

formula

The right hand side of a formula

data

A dataframe

Details

The sign of the terms in the formula determines whether sorting should be ascending or decreasing; see examples below

Value

The ordered data frame

Author(s)

Søren Højsgaard, [email protected] and Kevin Wright

See Also

transformBy, splitBy

Examples

1
2
3
orderBy(~ conc + Treatment, CO2)
## Sort decreasingly by conc
orderBy(~ - conc + Treatment, CO2)

hojsgaard/doBy documentation built on Oct. 11, 2019, 9:55 a.m.