last: Gives the last non-missing element

View source: R/shorthands.R

lastR Documentation

Gives the last non-missing element

Description

Just a simple shorthand to get the last, non-missing argument per default. Can give more than one element and can include missing elements. The inverse of first().

Usage

last(x, n = 1, na.rm = TRUE)

Arguments

x

vector of which you want the last element

n

number of elements to take from the end

na.rm

whether to remove missings first, defaults to TRUE

Examples

last( c(1:10,NA) )
last( c(1:10,NA), 2, TRUE )

rubenarslan/formr documentation built on Feb. 6, 2024, 1:18 a.m.