R/MeanOrMode.R

Defines functions MeanOrMode

#' @keywords internal
#'
MeanOrMode <- function(c){
  if(is.numeric(c)) (mean(c, na.rm = TRUE))
  else if(!all(is.na(c))){
    names(which.max(table(c)))
  } else NA
}

Try the SchoolDataIT package in your browser

Any scripts or data that you put into this service are public.

SchoolDataIT documentation built on Oct. 1, 2024, 9:06 a.m.