This function retrieves the first n
elements of a vector or list.
Examples
# Get the first element of a vector
getfirst(c(1, 2, 3, 4, 5))
#> [1] 1
# Get the first 2 elements of a vector
getfirst(c(1, 2, 3, 4, 5), 2)
#> [1] 2
# Get the first element of a list
getfirst(list("a", "b", "c"))
#> [1] "a"
# Get the first 2 elements of a list
getfirst(list("a", "b", "c"), 2)
#> [1] "b"