-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy patharrange_natural.Rd
59 lines (55 loc) · 1.68 KB
/
arrange_natural.Rd
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
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/arrange_natural.R
\name{arrange_natural}
\alias{arrange_natural}
\title{Arrange rows by column values naturally}
\usage{
arrange_natural(.data, ...)
}
\arguments{
\item{.data}{A data frame, data frame extension (e.g. a tibble), or a lazy
data frame (e.g. from dbplyr or dtplyr).}
\item{...}{<\code{\link[=dplyr_data_masking]{data-masking}}> Variables to sort by.}
}
\value{
An object of the same type as \code{.data}. The output has the following
properties:
\itemize{
\item All rows appear in the output, but (usually) in a different place.
\item Sorted columns are converted to factors.
\item All other columns are not modified.
\item Data frame attributes are preserved.
}
}
\description{
\code{arrange_natural()} orders the rows of a data frame by the values of selected
columns.
Data is naturally sorted (see \emph{Details}, below) in ascending order. Columns
used for sorting are converted to factors to preserve their ordering.
Grouping is ignored.
}
\details{
\subsection{Natural sorting}{
\code{arrange_natural()} is built on \code{\link[dplyr:arrange]{dplyr::arrange()}} to provide
\href{https://en.wikipedia.org/wiki/Natural_sort_order}{natural sorting}
(sorting of strings with both letters and numerals). The underlying
implementation for natural sorting is based on the
\link[stringi:about_stringi]{stringi} library.
}
}
\examples{
df <- tibble::tribble(
~sample, ~gene,
"D10-23", "atp6",
"D10-43", "mdr1",
"D10-55", "atp6",
"D10-5", "mdr1",
"D10-47", "dhps",
"D10-15", "atp6"
)
arrange_natural(df, sample)
df \%>\% arrange_natural(sample, gene)
}
\seealso{
\code{\link[dplyr:arrange]{dplyr::arrange()}}
}