Repository navigation
Expand file tree
/
Copy patharrange.Rd
More file actions
67 lines (57 loc) · 1.92 KB
/
Copy patharrange.Rd
File metadata and controls
67 lines (57 loc) · 1.92 KB
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/manip.r, R/tbl-df.r
\name{arrange}
\alias{arrange}
\alias{arrange.tbl_df}
\title{Arrange rows by variables}
\usage{
arrange(.data, ...)
\method{arrange}{tbl_df}(.data, ..., .by_group = FALSE)
}
\arguments{
\item{.data}{A tbl. All main verbs are S3 generics and provide methods
for \code{\link[=tbl_df]{tbl_df()}}, \code{\link[dtplyr:tbl_dt]{dtplyr::tbl_dt()}} and \code{\link[dbplyr:tbl_dbi]{dbplyr::tbl_dbi()}}.}
\item{...}{Comma separated list of unquoted variable names, or expressions
involving variable names. Use \code{\link[=desc]{desc()}} to sort a variable in descending order.}
\item{.by_group}{If \code{TRUE}, will sort first by grouping variable. Applies to
grouped data frames only.}
}
\value{
An object of the same class as \code{.data}.
}
\description{
Order tbl rows by an expression involving its variables.
}
\section{Locales}{
The sort order for character vectors will depend on the collating sequence
of the locale in use: see \code{\link[=locales]{locales()}}.
}
\section{Missing values}{
Unlike base sorting with \code{sort()}, \code{NA} are:
\itemize{
\item always sorted to the end for local data, even when wrapped with \code{desc()}.
\item treated differently for remote data, depending on the backend.
}
}
\section{Tidy data}{
When applied to a data frame, row names are silently dropped. To preserve,
convert to an explicit variable with \code{\link[tibble:rownames_to_column]{tibble::rownames_to_column()}}.
}
\examples{
arrange(mtcars, cyl, disp)
arrange(mtcars, desc(disp))
# grouped arrange ignores groups
by_cyl <- mtcars \%>\% group_by(cyl)
by_cyl \%>\% arrange(desc(wt))
# Unless you specifically ask:
by_cyl \%>\% arrange(desc(wt), .by_group = TRUE)
}
\seealso{
Other single table verbs:
\code{\link{filter}()},
\code{\link{mutate}()},
\code{\link{select}()},
\code{\link{slice}()},
\code{\link{summarise}()}
}
\concept{single table verbs}