x <- rpois(100, 8)
vec_unique(x)
vec_unique_loc(x)
vec_unique_count(x)
# `vec_unique()` returns values in the order that encounters them
# use sort = "location" to match to the result of `vec_count()`
head(vec_unique(x))
head(vec_count(x, sort = "location"))
# Normally missing values are not considered to be equal
NA == NA
# But they are for the purposes of considering uniqueness
vec_unique(c(NA, NA, NA, NA, 1, 2, 1))
Run the code above in your browser using DataLab