Skip to content

Instantly share code, notes, and snippets.

@limafelipe
Created March 9, 2017 14:40
Show Gist options
  • Save limafelipe/8369436f41135f0387f655911df01f5b to your computer and use it in GitHub Desktop.
Save limafelipe/8369436f41135f0387f655911df01f5b to your computer and use it in GitHub Desktop.
function to calculate Mode in R
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