powered by
Returns the most frequent value of a vector.
mode_value(x, na.rm = TRUE, getlast = TRUE, retain_class = TRUE)
The mode of x
x
Vector, factor or integer: Input data.
Logical: If TRUE, exclude NAs (using na.exclude(x)).
na.exclude(x)
Logical: If TRUE, get the last value in case of ties.
Logical: If TRUE, output is always same class as input.
EDG
x <- c(9, 3, 4, 4, 0, 2, 2, NA) mode_value(x) x <- c(9, 3, 2, 2, 0, 4, 4, NA) mode_value(x) mode_value(x, getlast = FALSE)
Run the code above in your browser using DataLab