Count Unique Values in R (3 Examples) | Get Frequency of Elements | table & aggregate Functions

Опубликовано: 10 Февраль 2025
на канале: Statistics Globe
8,496
71

This video explains how to count unique values in the R programming language. More information: https://statisticsglobe.com/r-frequen...



##### Example data
x <- c(3, 1, 4, 3, 1, 2, 1, 5) # Create example data

##### Example 1
table(x) # Apply table function

##### Example 2
as.data.frame(table(x)) # Different representation

##### Example 3
aggregate(data.frame(count = x), # Apply aggregate function
list(value = x),
length)