View source: R/first-last-nth.R
first | R Documentation |
Extract the first, last, or nth value from a vector.
Note: These are simple wrappers around vctrs::vec_slice()
.
first(x, default = NULL, na_rm = FALSE)
last(x, default = NULL, na_rm = FALSE)
nth(x, n, default = NULL, na_rm = FALSE)
x |
A vector |
default |
The default value if the value doesn't exist. |
na_rm |
If |
n |
For |
vec <- letters
first(vec)
last(vec)
nth(vec, 4)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.