File: last.Rd

package info (click to toggle)
r-cran-data.table 1.12.0%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 13,084 kB
  • sloc: ansic: 12,667; sh: 13; makefile: 6
file content (36 lines) | stat: -rw-r--r-- 1,137 bytes parent folder | download
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
\name{last}
\alias{last}
\title{ Last item of an object }
\description{
Returns the last item of a vector or list, or the last row of a data.frame or
data.table.
}
\usage{
last(x, \dots)
}
\arguments{
\item{x}{ A vector, list, data.frame or data.table. Otherwise the S3 method of
\code{xts::last} is deployed. }
\item{\dots}{ Not applicable for \code{data.table::last}. Any arguments here are
passed through to \code{xts::last}. }
}
% \details{
% }
\value{
If no other arguments are supplied it depends on the type of x. The last item
of a vector or list. The last row of a \code{data.frame} or \code{data.table}.
Otherwise, whatever \code{xts::last} returns (if package xts has been loaded,
otherwise a helpful error).

If any argument is supplied in addition to \code{x} (such as \code{n} or
\code{keep} in \code{xts::last}), regardless of \code{x}'s type, then
\code{xts::last} is called if xts has been loaded, otherwise a helpful error.
}
\seealso{ \code{\link{NROW}}, \code{\link{head}}, \code{\link{tail}},
\code{\link{first}} }
\examples{
last(1:5) # [1] 5
x = data.table(x=1:5, y=6:10)
last(x) # same as x[5]
}
\keyword{ data }