Calculation of quantiles

[https://www.codecademy.com/courses/learn-r/lessons/quantiles-r/exercises/quantiles-in-r?action=resume_content_item](the exercise)

How is the following:

dataset <- c(5, 10, -20, 42, -9, 10) ten_percent <- quantile(dataset, 0.10)

ten_percent now holds the value -14.5 .

being calculated?

I thought 10th quantile means the value that 1/10 of the values are below. since there are only 6 values in this dataset, the first value which is -20 is already 1/6 of the values which is more than 1/10, so the 10th quantile would either be -20 itself or the first value above it which is -9, I don’t understand how the average of the two smallest values is relevant?

Thank you for asking that question. No help from here, as trying to understand that too!

Your definition is correct and also the calculation, since the number of values is not a multiple of ten to calculate the tenth quantile that would stand between -20 and -9 they calculated their mean
-20 + (-9) = - 29
-29/2 = -14.5