R/moda.R

Defines functions moda

Documented in moda

moda <- function(x) {
    y <- table(x)
    nmax <- max(y)
    m <- names(y)[which(y==nmax)]
    #cat(paste0("Moda = ",m, " con frequenza ",nmax),"\n")
    return(list(moda=m, frequenza.modale=nmax))
}
#' @examples 
#' x <- sample(5,10,replace=TRUE)
#' moda(x)
#' 
masspastore/ADati documentation built on April 18, 2024, 5:55 p.m.