Does anyone know how to find the mode (most frequent across variables for a single case in R?
For example, if I had data on favorite type of fruit (x), asked nine t
A solution that chooses the lowest value for ties is given by:
modeStat = function(vals) { return(as.numeric(names(which.max(table(vals))))) } modeStat(c(1,3,5,6,4,5))
This returns:
[1] 5