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))
─ Session info ───────────────────────────────────────────────────────────────
 setting  value
 version  R version 4.5.2 (2025-10-31)
 os       macOS Tahoe 26.3
 system   aarch64, darwin20
 ui       X11
 language (EN)
 collate  en_US.UTF-8
 ctype    en_US.UTF-8
 tz       Europe/London
 date     2026-02-23
 pandoc   3.6.3 @ /Applications/Positron.app/Contents/Resources/app/quarto/bin/tools/aarch64/ (via rmarkdown)
 quarto   1.8.27 @ /Applications/Positron.app/Contents/Resources/app/quarto/bin/quarto

─ Packages ───────────────────────────────────────────────────────────────────
 ! package     * version date (UTC) lib source
 P cli           3.6.5   2025-04-23 [?] RSPM
 P digest        0.6.39  2025-11-19 [?] RSPM
 P evaluate      1.0.5   2025-08-27 [?] RSPM
 P fastmap       1.2.0   2024-05-15 [?] RSPM
 P htmltools     0.5.9   2025-12-04 [?] RSPM
 P htmlwidgets   1.6.4   2023-12-06 [?] RSPM
 P jsonlite      2.0.0   2025-03-27 [?] RSPM
 P knitr         1.51    2025-12-20 [?] RSPM
 P otel          0.2.0   2025-08-29 [?] RSPM
   renv          1.0.10  2024-10-05 [1] RSPM (R 4.5.2)
 P rlang         1.1.7   2026-01-09 [?] RSPM
 P rmarkdown     2.30    2025-09-28 [?] RSPM
 P sessioninfo   1.2.3   2025-02-05 [?] RSPM
 P xfun          0.56    2026-01-18 [?] RSPM
 P yaml          2.3.12  2025-12-10 [?] RSPM

 [1] /Users/christinafillmore/Documents/GitHub/CAMIS/renv/library/macos/R-4.5/aarch64-apple-darwin20
 [2] /Library/Frameworks/R.framework/Versions/4.5-arm64/Resources/library

 P ── Loaded and on-disk path mismatch.

──────────────────────────────────────────────────────────────────────────────