How to use quantiles to calculate Deciles In R Language
In this method, we use quantile() method. For this probs, parameters have to be varied.
Syntax:
quantile(data, probs)
Parameter:
- data is the data in consideration
- probs is the required percentile
Example:
In this example, we calculate deciles using quantile() function in the R language.
R
# create dataframe df<- data.frame (x= c (2,13,5,36,12,50), y= c ( 'a' , 'b' , 'c' , 'c' , 'c' , 'b' )) # calculate deciles res<- quantile (df$x, probs= seq (0.1,1, by=0.1)) # display res |
Output:
10% 20% 30% 40% 50% 60% 70% 80% 90% 100%
3.5 5.0 8.5 12.0 12.5 13.0 24.5 36.0 43.0 50.0
How to Calculate Deciles in R?
In this article, we will discuss how to calculate deciles in the R programming language.
Deciles are numbers that split a dataset into ten groups, each of equal frequency.