Build the indexes of last indexes for each group

last_in_each_group(first_indices)

Arguments

first_indices

first index of each item (in order).

Value

vector of last indices

Examples

fi <- c(1, 1, 3, 3, 3) last_in_each_group(fi)
#> [1] 2 2 5 5 5