Observation in each percentile


I've just started using Rstudio and have a question I hope you can answer.
I'm trying to identify how many observations I have in my dataset for each percentile groups that I have defined e.g 5%, 10%, 25%, 50%, 75%, 90% and 95%. I hope this question makes sense.

Best regards

Hi, welcome:

Your question is a bit general, but that may be of help for what you are looking for:

## some data
Data <- data.frame(value = runif(1000))
## your quantiles of interest
qu <- quantile(Data$value, c(.05, .1,.25,.5,.75,.9,.95,1))
## your values
table(names(qu[findInterval(Data$value, qu)]))
 10% 100%  25%   5%  50%  75%  90%  95% 
 150    1  250   50  250  150   50   49 

But please, note that in the table they are not properly ordered, and i don't know if this is an issue for you or not.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.