Skip to content

Instantly share code, notes, and snippets.

@nassimhaddad
Created December 16, 2013 11:28
Show Gist options
  • Save nassimhaddad/7985652 to your computer and use it in GitHub Desktop.
Save nassimhaddad/7985652 to your computer and use it in GitHub Desktop.
cut_equal <- function(x, n = 3){
q <- quantile(x, prob= seq(0,1,length.out = n+1 ))
cut(x,
breaks = as.numeric(q),
include.lowest=TRUE, labels = 1:n)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment