R/get_mode.R

Defines functions get_mode

Documented in get_mode

#' Get the mode of a vector
#'
#' @param x a vector
#'
#' @return Mode of x
#' @export


get_mode <- function(x) {
  values <- unique(stats::na.omit(x))
  values[which.max(tabulate(match(x, values)))]
}
jpetrovich02/CCMHr documentation built on Jan. 25, 2024, 11:57 p.m.