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. 9, 2025, 11:47 p.m.