R/counters.R
prop_distinct.Rd
Find the proportion of values of x that are distinct.
x
prop_distinct(x)
A vector to check.
The ratio of distinct values x to total values of x.
length(unique(x))/length(x)
Other counting wrappers: count_diff(), count_in(), count_na(), count_out(), na_in(), na_out(), na_rep(), prop_in(), prop_na(), prop_out(), what_in(), what_out()
count_diff()
count_in()
count_na()
count_out()
na_in()
na_out()
na_rep()
prop_in()
prop_na()
prop_out()
what_in()
what_out()
prop_distinct(c("VT", "VT", NA, "ME")) #> [1] 0.75