-
-
Notifications
You must be signed in to change notification settings - Fork 17
Closed
Labels
Description
Saw some discussion on Twitter about how base-R doesn't have a function to calculate mode. So was wondering if it might be a good idea for us to include this info.
library(parameters)
describe_distribution(mtcars$wt)
#> Mean | SD | IQR | Range | Skewness | Kurtosis | n | n_Missing
#> ------------------------------------------------------------------------
#> 3.22 | 0.98 | 1.19 | [1.51, 5.42] | 0.47 | 0.42 | 32 | 0
getmode <- function(v) {
uniqv <- unique(v)
uniqv[which.max(tabulate(match(v, uniqv)))]
}Created on 2021-06-03 by the reprex package (v2.0.0)
Reactions are currently unavailable