Skip to content
Prev 70466 / 398525 Next

a more elegant approach to getting the majority level

Rajarshi Guha wrote:

            
(== TRUE) can ALWAYS be omitted, see also:
  library(fortunes)
  fortune("TRUE")

x == max(x) should be replaced by which.max(x)

as.logical() is superfluous


Hence we get:
   names(which.max(table(x)))

Uwe Ligges