I would like R to output all of the modes for a particular group. Currently, R is giving me just the single mode, which is fine if there is only one mode. However, I would like an output of all modes, if more than one exists. Below is the function I am using for the mode, and I was wondering how it could be modified so that I could do this?
Mode <- function(x) {
uni <- unique(x)
uni[which.max(tabulate(match(x, uni)))]
}