Run »
mode <- function(x) { unique_values <- unique(x) table <- tabulate(match(x, unique_values)) unique_values[table == max(table)] } values <- c(4,7,3,8,11,7,10,19,6,9,12,12) mode(values)
[1] 7 12