Skip to content

Commit 9b02ebf

Browse files
committed
clarify sort_by R>=4.4.0
1 parent c87e547 commit 9b02ebf

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

man/setorder.Rd

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ setorderv(x, cols = colnames(x), order=1L, na.last=FALSE)
3333
# optimised to use data.table's internal fast order
3434
# x[order(., na.last=TRUE)]
3535
# x[order(., decreasing=TRUE)]
36-
# sort_by(x, ., na.last=TRUE, decreasing=FALSE)
36+
# sort_by(x, ., na.last=TRUE, decreasing=FALSE) # R >= 4.4.0
3737
}
3838
\arguments{
3939
\item{x}{ A \code{data.table}. }
@@ -48,7 +48,7 @@ when \code{b} is of type \code{character} as well. }
4848
\code{order} must be either \code{1} or equal to that of \code{cols}. If
4949
\code{length(order) == 1}, it is recycled to \code{length(cols)}. }
5050
\item{na.last}{ \code{logical}. If \code{TRUE}, missing values in the data are placed last; if \code{FALSE}, they are placed first; if \code{NA} they are removed.
51-
\code{na.last=NA} is valid only for \code{x[order(., na.last)]} and related \code{sort_by(x, .)} and its
51+
\code{na.last=NA} is valid only for \code{x[order(., na.last)]} and related \code{sort_by(x, .)} (\eqn{\R \ge 4.4.0}) and its
5252
default is \code{TRUE}. \code{setorder} and \code{setorderv} only accept
5353
\code{TRUE}/\code{FALSE} with default \code{FALSE}. }
5454
}
@@ -73,7 +73,7 @@ sets the \code{sorted} attribute.
7373

7474
\code{na.last} argument, by default, is \code{FALSE} for \code{setorder} and
7575
\code{setorderv} to be consistent with \code{data.table}'s \code{setkey} and
76-
is \code{TRUE} for \code{x[order(.)]} and \code{sort_by(x, .)} to be consistent with \code{base::order}.
76+
is \code{TRUE} for \code{x[order(.)]} and \code{sort_by(x, .)} (\eqn{\R \ge 4.4.0}) to be consistent with \code{base::order}.
7777
Only \code{x[order(.)]} (and related \code{sort_by(x, .)}) can have \code{na.last = NA} as it is a subset operation
7878
as opposed to \code{setorder} or \code{setorderv} which reorders the data.table
7979
by reference.
@@ -99,7 +99,7 @@ was started in. By contrast, \code{"america" < "BRAZIL"} is always \code{FALSE}
9999
If \code{setorder} results in reordering of the rows of a keyed \code{data.table},
100100
then its key will be set to \code{NULL}.
101101
102-
\code{sort_by(x, y, \dots)} is the S3 method for the generic \code{sort_by} for \code{data.table}'s.
102+
Starting from \R 4.4.0, \code{sort_by(x, y, \dots)} is the S3 method for the generic \code{sort_by} for \code{data.table}'s.
103103
It uses the same formula or list interfaces as data.frame's \code{sort_by} but internally uses \code{data.table}'s fast ordering,
104104
hence it behaves the same as \code{x[order(.)]} and takes the same optional named arguments and their defaults.
105105

0 commit comments

Comments
 (0)