R/mode.R

Defines functions mode

Documented in mode

#' mode
#'
#' @param x vector to get mode of
#'
#' @return the mode
#' @export
#'
mode <- function(x) {
  ux   <- unique(x)[!is.na(unique(x))]
  r    <- ux[which.max(tabulate(match(x, ux)))]
  return(r)
}
nicksunderland/acsprojectns documentation built on July 20, 2023, 7:23 p.m.