View source: R/vector_occurrence.R
| vector_occurrence | R Documentation |
This function finds the positions of first or last occurrence of unique vector elements.
vector_occurrence(x, type = "first")
x |
[ |
type |
[ |
An integer vector, the positions of the unique vector elements.
The ordering corresponds to unique(x), i.e., the i-th element in
the output is the (first or last) occurrence of the i-th element from
unique(x).
Other vector helpers:
check_numeric_vector(),
check_probability_vector(),
chunk_vector(),
equidistant_vectors(),
insert_vector_entry(),
map_indices(),
match_numerics(),
permutations(),
split_vector_at(),
subsets()
x <- c(1, 1, 1, 2, 2, 2, 3, 3, 3)
unique(x)
vector_occurrence(x, "first")
vector_occurrence(x, "last")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.