Skip to content

Instantly share code, notes, and snippets.

@Isaquedanielre
Created December 2, 2015 00:13
Show Gist options
  • Save Isaquedanielre/61c0b65fc5ee4b26be75 to your computer and use it in GitHub Desktop.
Save Isaquedanielre/61c0b65fc5ee4b26be75 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