R/most_frequent.R

Defines functions most_frequent

#' @export
most_frequent <- function(x, na.rm = TRUE) {
  if (isTRUE(na.rm)) x <- stats::na.omit(x)
  ux <- unique(x)
  ux[which.max(tabulate(match(x, ux)))]
}
BAAQMD/qtytools documentation built on June 30, 2022, 6:07 p.m.