Skip to content

Commit 565e0b3

Browse files
clarify first() vs x[1]
1 parent 5bbc4d5 commit 565e0b3

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

man/last.Rd

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ of \code{xts::first} is deployed. }
1818
\item{\dots}{ Not applicable for \code{data.table} first/last. Any arguments here
1919
are passed through to \code{xts}'s first/last. }
2020
}
21+
\details{
22+
Note: \code{first(x)} is not an exact replacement for \code{x[1]}. It differs in its handling of zero-length vectors (returning a zero-length vector instead of \code{NA}) and does not preserve attributes like names.
23+
}
2124
\value{
2225
If no other arguments are supplied it depends on the type of \code{x}. The first/last item
2326
of a vector or list. The first/last row of a \code{data.frame} or \code{data.table}.

0 commit comments

Comments
 (0)