Skip to content

Instantly share code, notes, and snippets.

@gorkemozkaya
Created September 15, 2017 03:30
Show Gist options
  • Save gorkemozkaya/881b841e47462383ca0df446865cd532 to your computer and use it in GitHub Desktop.
Save gorkemozkaya/881b841e47462383ca0df446865cd532 to your computer and use it in GitHub Desktop.
how to convert a quantitative column into categorical with 10 equal segments
q2c <- function(col) {
breaks = quantile(col, seq(0.1, 0.9, 0.1), na.rm=TRUE)
cuts <- addNA(cut(col, breaks = breaks))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment