R/ds.mode.R

Defines functions ds.mode

Documented in ds.mode

###############################################################################################
##### Mode for numeric variables
###############################################################################################

ds.mode <- function(x){

  x <- na.omit(x)
  uniquex <- unique(x)
  uniquex[which.max(tabulate(match(x, uniquex)))]

}

Try the YRmisc package in your browser

Any scripts or data that you put into this service are public.

YRmisc documentation built on March 25, 2020, 5:13 p.m.