orderBy {doBy}R Documentation

Ordering (sorting) rows of a data frame

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

orderBy(formula, data, na.last = TRUE, decreasing = FALSE)

Arguments

formula The right hand side of a formula
data A data frame
na.last for controlling the treatment of 'NA's. If 'TRUE', missing values in the data are put last; if 'FALSE', they are put first; if 'NA', they are removed.
decreasing logical. Should the sort order be increasing or decreasing?

Value

The ordered data frame

Author(s)

Søren Højsgaard, sorenh@agrsci.dk

See Also

~~objects to See Also as help, ~~~

Examples

data(dietox)
orderBy(~Time+Evit, data=dietox)

[Package doBy version 0.4 Index]