sortdf: Order the rows of a data frame

Description Usage Arguments Value Author(s) Examples

View source: R/pipeline.R

Description

Order the rows of a data frame using variables identified in a formula evaluated in the data frame. Convenient in a pipeline.

Usage

1
sordf( data, form )

Arguments

data

a data frame

form

a formula identifying variables to be used in sorting

Value

The formula is evaluated using model.frame and the result is used as the argument of order which, in turn is used to order the data frame. The ordered data frame is returned.

For example, using the Prestige data set in package:car and the pipeline function in package:magrittr, we can sort the data frame with:

> require(car) > require(magrittr) > Prestige

Author(s)

G. Monette

Examples

1
2
3
4
5
6
## Not run: 
require(car)
require(magrittr)
Prestige  

## End(Not run)

gmonette/spida documentation built on May 17, 2019, 7:25 a.m.