Learn R Programming

docore (version 1.0)

last: Last element of a vector

Description

Returns the last element of a vector or the n-th element counting from the end of a vector.

Usage

last(x, n = 1)

Arguments

x

vector

n

optional integer specifying the n-th element from the end to be returned

Value

scalar of the same type as x