R/first-last-nth.R
last..Rd
Extract the first, last, or nth value from a vector.
Note: These are simple wrappers around vctrs::vec_slice().
vctrs::vec_slice()
last.(x, default = NULL, na_rm = FALSE)
A vector
The default value if the value doesn't exist.
If TRUE ignores missing values.
TRUE
vec <- letters first(vec) #> [1] "a" last(vec) #> [1] "z" nth(vec, 4) #> [1] "d"