Quantiles in R (Example)

In this article I’ll explain how to calculate the quantiles of a numeric data object in the R programming language.

Example Data

In this example, we’ll compute the quantiles of the following numeric vector:

x <- c(6, 6, 8, 5, 3, 9, 1, 7, 5, 2)    # Create example vector

Example: Application of quantile Function in R

We can compute the quantiles of our data with the quantile() function as shown below:

quantile(x)                             # Compute quantiles
#   0%  25%  50%  75% 100% 
# 1.00 3.50 5.50 6.75 9.00

Leave a Reply

Your email address will not be published. Required fields are marked *

Fill out this field
Fill out this field
Please enter a valid email address.
You need to agree with the terms to proceed

Menu
Top