1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
|
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/data_arrange.R
\name{data_arrange}
\alias{data_arrange}
\title{Arrange rows by column values}
\usage{
data_arrange(data, select = NULL, safe = TRUE)
}
\arguments{
\item{data}{A data frame, or an object that can be coerced to a data frame.}
\item{select}{Character vector of column names. Use a dash just before column
name to arrange in decreasing order, for example \code{"-x1"}.}
\item{safe}{Do not throw an error if one of the variables specified doesn't
exist.}
}
\value{
A data frame.
}
\description{
\code{data_arrange()} orders the rows of a data frame by the values of selected
columns.
}
\examples{
# 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))
}
|