I'd like to ask for a feature that I often use in summarise() calls esp. in grouped data frames.
It would be very helpful to be able to compute the mode (= value that appears most often in a set of values) of a vector.
Please correct me if I am wrong but I think there is no base R or dplyr solution for that. However, there are multiple sources that suggest a solution for a vectorized function that computes the mode.
The following suggestion is based on a Stack Overflow discussion.
I'd like to ask for a feature that I often use in
summarise()
calls esp. in grouped data frames.It would be very helpful to be able to compute the
mode
(= value that appears most often in a set of values) of a vector. Please correct me if I am wrong but I think there is no base R or dplyr solution for that. However, there are multiple sources that suggest a solution for a vectorized function that computes the mode. The following suggestion is based on a Stack Overflow discussion.Created on 2021-03-25 by the reprex package (v1.0.0)