Extract Most Common Values from Vector in R (Example) | Get Frequency of Elements | table() & sort()

preview_player
Показать описание
R code of this video:

vec <- c("A", "B", "B", "C", "F", # Create example vector
"A", "D", "F", "A", "E")
vec # Print example vector

table(vec) # Apply table function

sort(table(vec), decreasing = TRUE)[1:3] # Extract most common value

Follow me on Social Media:
Рекомендации по теме
Комментарии
Автор

Thank you very much! I have learned a lot from your channel.

timding
Автор

How do we get it to just show "A" without the count?

newomunyai