function that directly calculates the number of unique values in a vector.
n_distinct is a faster and more concise equivalent of length(unique(x)).
function that directly calculates the number of unique values in a vector.
n_distinct is a faster and more concise equivalent of length(unique(x)).