This function calculates the most common value(s) of a given set
get_mode(x, moden = 1, quiet = FALSE)
A variable or vector (numeric, character or factor)
If there are multiple modes, which mode to use. The default is the first mode.
By default, messages are printed if multiple modes are selected. To hide these messages, set quiet
to TRUE
A vector of length 1 containing the mode
get_mode(trial$stage)
#> [1] T2
#> Levels: T1 T2 T3 T4
get_mode(trial$trt)
#> [1] "Drug B"
get_mode(trial$response)
#> [1] 0
get_mode(trial$grade)
#> There are multiple modes in this dataset: I II. By default, the first mode 'I' was selected. The selected mode can be changed using the `moden=` option.
#> [1] I
#> Levels: I II III