Learn R Programming

tidytable (version 0.10.2)

last.: Extract the first, last, or nth value from a vector

Description

Extract the first, last, or nth value from a vector.

Note: These are simple wrappers around vctrs::vec_slice().

Usage

last.(x, default = NULL, na_rm = FALSE)

Arguments

x

A vector

default

The default value if the value doesn't exist.

na_rm

If TRUE ignores missing values.

Examples

Run this code
vec <- letters

first(vec)
last(vec)
nth(vec, 4)

Run the code above in your browser using DataLab