https://github.com/cran/pracma
Raw File
Tip revision: 9a644c12884525087aa1db3ecf57586b29fb17d8 authored by HwB on 06 June 2011, 00:00:00 UTC
version 0.5-3
Tip revision: 9a644c1
mode.R
##
##  m o d e . R
##


mode <- pracma::mode

x <- c(1:100, rep(5,3), rep(27,5), rep(71,4), rep(89,2), rep(100, 5))
identical(mode(x), 27)

x <- as.factor(x)
identical(mode(x), "27")

# order of complex values?
# x <- c(1+1i, 1i, -1, -1i, 1-1i, 1)
# identical(mode(x), 1i)
back to top