Skip to content

Instantly share code, notes, and snippets.

@jkaupp
Created December 3, 2015 17:23
Show Gist options
  • Save jkaupp/8865f25eaae76f84a4d4 to your computer and use it in GitHub Desktop.
Save jkaupp/8865f25eaae76f84a4d4 to your computer and use it in GitHub Desktop.
R function to calculate the mode of a dataset.
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