
Last chance! 50% off unlimited learning
Sale ends in
[[
. The main
advantage is that you can provide an optional secondary vector that defines
the ordering, and provide a default value to use when the input is shorter
than expected.nth(x, n, order_by = NULL, default = default_missing(x))first(x, order_by = NULL, default = default_missing(x))
last(x, order_by = NULL, default = default_missing(x))
nth_value
, a single integer specifying the position.
If a numeric is supplied, it will be silently truncated.NULL
is return. For more complicated objects, y[[
is used to do the subsetting.x <- 1:10
y <- 10:1
last(x)
last(x, y)
Run the code above in your browser using DataLab