R/read_mode.R

Defines functions read_mode

Documented in read_mode

#' @title Mode
#' @description Calculates the statistical mode
#' @param vec A numeric/integer vector
#' @return The mode of the submitted vector
#' @export

read_mode <- function(vec){
  
  vec %>% 
    tabyl() %>%
    arrange(desc(n)) %>%
    pull(1) %>%
    pluck(1)
  
}
gfleetwood/sansor documentation built on Nov. 23, 2022, 10:31 a.m.