Created
December 3, 2015 17:23
-
-
Save jkaupp/8865f25eaae76f84a4d4 to your computer and use it in GitHub Desktop.
R function to calculate the mode of a dataset.
This file contains hidden or 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