There are several quartiles of an observation variable. The first quartile, or lower quartile, is the value that cuts off the first 25% of the data when it is sorted in ascending order. The second quartile, or median, is the value that cuts off the first 50%. The third quartile, or upper quartile, is the value that cuts off the first 75%.
Find the quartiles of the eruption durations in the data set faithful.
We apply the quantile function to compute the quartiles of eruptions.
> quantile(duration) # apply the quantile function
0% 25% 50% 75% 100%
1.6000 2.1627 4.0000 4.4543 5.1000
The first, second and third quartiles of the eruption duration are 2.1627, 4.0000 and 4.4543 minutes respectively.
Find the quartiles of the eruption waiting periods in faithful.
There are several algorithms for the computation of quartiles. Details can be found in the R documentation via help(quantile).