Skip to content

Instantly share code, notes, and snippets.

@atbradley
Created December 17, 2015 20:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save atbradley/97741e93d7ba57d482c7 to your computer and use it in GitHub Desktop.
Save atbradley/97741e93d7ba57d482c7 to your computer and use it in GitHub Desktop.
Function to return the statistical mode in R.
smode <- function(x) {
which(tabulate(x)==max(tabulate(x)))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment