last | R Documentation |
Extract the last elements of a vector.
last(x, length.out = 1, na.rm = FALSE)
x |
any vector. |
length.out |
integer indicating how many element are desired. If
positive, return the |
na.rm |
logical indicating if the last non-missing value (if any)
shall be returned. By default (it is |
a vector of length abs(length.out)
of last values from x
.
This function may eventually be deprecated for the standard R
function tail()
.
Useful for the turnogram()
function in package
pastecs.
Werner Stahel (stahel@stat.math.ethz.ch), and independently, Philippe Grosjean (phgrosjean@sciviews.org), Frédéric Ibanez (ibanez@obs-vlfr.fr).
first
, turnogram
a <- c(NA, 1, 2, NA, 3, 4, NA)
last(a)
last(a, na.rm=TRUE)
last(a, length = 2)
last(a, length = -3)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.