| by-order | R Documentation | 
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.
order_by(data, formula)
orderBy(formula, data)
data | 
 A dataframe  | 
formula | 
 The right hand side of a formula  | 
The sign of the terms in the formula determines whether sorting should be ascending or decreasing; see examples below
The ordered data frame
Søren Højsgaard, sorenh@math.aau.dk and Kevin Wright
transformBy, transform_by, splitBy, split_by
orderBy(~ conc + Treatment, CO2)
## Sort decreasingly by conc
orderBy(~ - conc + Treatment, CO2)
## Same as:
order_by(CO2, c("conc", "Treatment"))
order_by(CO2, c("-conc", "Treatment"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.