How to use the quantile function in R

0

The quantile function in R displays sample quantiles corresponding to given probabilities. The smallest observation corresponds to a probability of 0 and the largest to a probability of 1.

The function’s general usage is:

quantile(x, ...)

## Default method:
quantile(x, probs = seq(0, 1, 0.25), na.rm = FALSE,
         names = TRUE, type = 7, ...)

Lets walk through a real example of using the quantile function.

> testScores <- c(1,2,24,33,46,56,64,78,92,106,111)
> summary(testScores)
   Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
   1.00   28.50   56.00   55.73   85.00  111.00 
> quantile(testScores)
   0%   25%   50%   75%  100% 
  1.0  28.5  56.0  85.0 111.0 

What does this tell us?
This implies that 25% of the test scores fall below 28.5 while 75% of the test scores are equal to or above 85. Half of the scores are equal to or above 56.

There are many different types of quantile functions in R. Make sure to explore those as the version we offer here is a general usage of the quantile function.

LEAVE A REPLY

Please enter your comment!
Please enter your name here