R/mode.R

Defines functions Mode

Documented in Mode

#' @title mode (average)
#' @description returns the most frequently occuring value in a variable
#' @param x a variable
#' @export
Mode <- function(x) {
  ux <- unique(x)
  ux[which.max(tabulate(match(x, ux)))]
}
dprocter/dpfuncs documentation built on May 21, 2019, 9:20 a.m.