# create example data
x <- rnorm(1000)
# cut into quartiles
quartiles <- CutQ(x)
table(quartiles)
# cut into deciles
deciles <- CutQ(x, seq(0, 1, by=0.1), labels=NULL)
table(deciles)
# show handling of 'tied' quantiles.
x <- round(x) # discretize to create ties
stem(x) # display the ties
deciles <- CutQ( x, seq(0, 1, by=0.1) )
table(deciles) # note that there are only 5 groups (not 10)
# due to duplicates
Run the code above in your browser using DataLab