data_arrange | R Documentation |
data_arrange()
orders the rows of a data frame by the values of selected
columns.
data_arrange(data, select = NULL, safe = TRUE)
data |
A data frame, or an object that can be coerced to a data frame. |
select |
Character vector of column names. Use a dash just before column
name to arrange in decreasing order, for example |
safe |
Do not throw an error if one of the variables specified doesn't exist. |
A data frame.
# Arrange using several variables
data_arrange(head(mtcars), c("gear", "carb"))
# Arrange in decreasing order
data_arrange(head(mtcars), "-carb")
# Throw an error if one of the variables specified doesn't exist
try(data_arrange(head(mtcars), c("gear", "foo"), safe = FALSE))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.