count | R Documentation |
Counts the number of occurrences of each element in the provided vector. Counting of NAs in addition to non-NA values is supported.
count(vec = NULL)
vec |
(vector) vector containing elements to count |
(dataframe) two-column dataframe with as many rows as there are unique elements in the provided vector. First column is named "value" and includes the unique elements of the vector, second column is named "count" and includes the number of occurrences of each vector element.
# Count instances of vector elements
count(vec = c(1, 1, NA, "a", 1, "a", NA, "x"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.