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 PMmisc package in your browser

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

PMmisc documentation built on May 1, 2019, 9:57 p.m.