Skip to content

Commit 74c4fab

Browse files
committed
setkey.rd
1 parent 4d6bfe3 commit 74c4fab

File tree

1 file changed

+6
-12
lines changed

1 file changed

+6
-12
lines changed

man/setkey.Rd

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -74,18 +74,12 @@ The sort is \emph{stable}; i.e., the order of ties (if any) is preserved.
7474
For character vectors, \code{data.table} takes advantage of R's internal global string cache, also exported as \code{\link{chorder}}.
7575
}
7676

77-
\section{Key vs. Index Subsetting}{
78-
When using \code{setkey}:
79-
\itemize{
80-
\item Subsetting can omit \code{on} (e.g., \code{DT[.(value)]})
81-
\item Data is physically reordered in RAM
82-
}
83-
When using \code{setindex}:
84-
\itemize{
85-
\item Must specify \code{on} (e.g., \code{DT[.(value), on = "col"]})
86-
\item Multiple indices can coexist via \code{setindexv(x, list(cols))}
87-
\item Original row order is preserved
88-
}
77+
\section{Keys vs. Indices}{
78+
Setting a key (with \code{setkey}) and an index (with \code{setindex}) are similar, but have very important distinctions.
79+
80+
Setting a key physically reorders the data in RAM.
81+
82+
Setting an index computes the sort order, but instead of applying the reordering, simply \emph{stores} this computed ordering. That means that multiple indices can coexist, and that the original row order is preserved.
8983
}
9084

9185
\section{Good practice}{

0 commit comments

Comments
 (0)