Learn R Programming

pastecs (version 1.3.21)

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)

Value

a numerical value

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

Author

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

See Also

first, turnogram

Examples

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

Run the code above in your browser using DataLab