Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

last

Get the last element of a vector


Description

Extract the last element of a vector. Useful for the turnogram() function

Usage

last(x, na.rm=FALSE)

Arguments

x

a numerical vector

na.rm

if na.rm=TRUE, then the last non-missing value (if any) is returned. By default, it is FALSE and the last element (whatever its value) is returned

Value

a numerical value

Author(s)

Philippe Grosjean (phgrosjean@sciviews.org), Frédéric Ibanez (ibanez@obs-vlfr.fr)

See Also

Examples

a <- c(NA, 1, 2, NA, 3, 4, NA)
last(a)
last(a, na.rm=TRUE)

pastecs

Package for Analysis of Space-Time Ecological Series

v1.3.21
GPL-2
Authors
Philippe Grosjean [aut, cre], Frederic Ibanez [aut], Michele Etienne [ctb]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.