Deriving Quantiles or Percentiles in R

Percentiles can be calculated in R using the quantile function. The function has the argument type which allows for nine different percentile definitions to be used. The default is type = 7, which uses a piecewise-linear estimate of the cumulative distribution function to find percentiles.

This is how the 25th and 40th percentiles of aval could be calculated using the default type.

quantile(aval, probs = c(0.25, 0.4))