#' Statistical mode
#'
#' R doesn't have a built-in function for calculating the statistical mode. This
#' function implements that.
#' @param x numeric, character or factor data.
#' @keywords mode
#' @export
#' @examples
#' mode_stat(c("A", "A", LETTERS[1:10]))
#' mode_stat(c("1", "1", 1:10))
mode_stat <- function(x) {
ux <- unique(x)
ux[which.max(tabulate(match(x, ux)))]
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.