R/find_mode.R

Defines functions find_mode

Documented in find_mode

#' Find the mode in the list of values (i.e., the most frequent value)
#'
#' @param v The list of values for which to find the mode
#'
#' @return The mode
#' @export
find_mode = function(v) {
  uniqv = unique(v)
  return(uniqv[which.max(tabulate(match(v, uniqv)))])
}
LisaHopcroft/CTutils documentation built on Oct. 7, 2021, 11:08 p.m.