last: Get the last element

Description Usage Arguments Author(s) See Also Examples

View source: R/last.R

Description

Extract the last element of an object using '[' or '[['

Usage

1
last(x, ...)

Arguments

x

An object such as a vector or a list that has '[' or '[[' methods defined for it

...

Advanced arguments.

Author(s)

L. Collado-Torres

See Also

dots

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
## Last element of a vector
last(1:10)

## Simple example list
l <- list(a = 1:10, b = 11:20)

## Get the last element using the '[' operator
last(l)

## Get the last element usign the '[[' operator
last(l, selector = '[[')

lcolladotor/dots documentation built on Aug. 24, 2019, 5:23 p.m.