I get that the definition of the first quartile is the value of the data set in which it is greater than 25% of the data set; below I have defined a vector in R (which is already ordered)
datold = c(12,
32, 32, 32, 32, 32,
35, 35, 35, 35, 35, 35, 35,
38, 38, 38, 38, 38, 38, 38, 38,
42, 42, 42, 42, 42)
Notice that this set of data is already ordered from lowest to greatest and there are 26 elements in this data set; since the 1st quartile is the 25th percentile, I take 26/4, which is 6.5. In order to find the 1st quartile now, would it not be correct to take the average of the 6th and 7th value? That being $(32+35)/2 = 33.5$?
The value that R outputs when you do summary(datold) is 35. I'm just trying to understand the error in my understanding; any help would be appreciated.
Just editing in to add that the question from the textbook asks what the IQR of the data set is (and the answer provided was 3 which I assume they got from 38-35).