A convenience function that returns the mode

get_mode(x, na.rm = TRUE)

Arguments

x

The dataframe or vector for which the mode is required.

na.rm

Logical. Should `NA`s be dropped? Defaults to `TRUE`

Value

a data.frame or vector showing the mode of the variable(s)

Details

Useful when used together with get_stats in a pipe fashion. These functions are for exploratory data analysis The smallest number is returned if there is a tie in values The function is currently slow for greater than 300,000 rows. It may take up to a minute. may work with inaccuracies. By default, NAs are discarded.

Examples

test<-c(1,2,3,3,3,3,4,5)
test2<-c(455,7878,908981,NA,456,455,7878,7878,NA)
get_mode(test)
#> [1] 3
get_mode(test2)
#> [1] 7878
if (FALSE) {
mtcars %>%
get_data_Stats(get_mode)
get_data_Stats(mtcars,get_mode)}