Created
March 9, 2017 14:40
-
-
Save limafelipe/8369436f41135f0387f655911df01f5b to your computer and use it in GitHub Desktop.
function to calculate Mode in R
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Mode <- function(x) { | |
ux <- unique(x) | |
ux[which.max(tabulate(match(x, ux)))] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment