Skip to content

Instantly share code, notes, and snippets.

@randrescastaneda
Created July 21, 2020 21:34
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 randrescastaneda/1311efea70a178b95d8ed47e80d925b7 to your computer and use it in GitHub Desktop.
Save randrescastaneda/1311efea70a178b95d8ed47e80d925b7 to your computer and use it in GitHub Desktop.
Create quantiles based on size of sample (This is not the same as percentiles)
qtile <- function(x, nq = 10) {
N <- length(x)
csw <- 1:N
qp <- floor(csw/((N+1)/nq)) + 1
return(qp)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment