sortdf | R Documentation |
Order the rows of a data frame using variables identified in a formula evaluated in the data frame. Convenient in a pipeline.
sortdf(data, form = formula(data))
data |
a data frame |
form |
a variable, list of variables, or a formula identifying variables to be used in sorting or an
object that can be used directly in |
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.
## Not run:
require(car)
require(magrittr)
Prestige %>% sortdf(~type+income) -> Prestige.ordered
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.