vec_count(mtcars$vs)
vec_count(iris$Species)
# If you count a data frame you'll get a data frame
# column in the output
str(vec_count(mtcars[c("vs", "am")]))
# Sorting ---------------------------------------
x <- letters[rpois(100, 6)]
# default is to sort by frequency
vec_count(x)
# by can sort by key
vec_count(x, sort = "key")
# or location of first value
vec_count(x, sort = "location")
head(x)
# or not at all
vec_count(x, sort = "none")
Run the code above in your browser using DataLab