powered by
Find the number of unique elements in a vector.
ntypes (vector)
The vector of interest.
Santiago Barreda <sbarreda@ucdavis.edu>
A simple function that converts a vector to a factor, and finds the number of levels. This provides the number of unique elements in a vector, something I find I frequently need.
data (pb52) ## the number of unique vowel categories. ntypes (pb52$vowel)
Run the code above in your browser using DataLab