I have a dataframes with a column called Means. I want to get just the first quartile from this column. I know I can use quartile (df) or summary (df) but this gives me all the quartiles. How do I get just the first?
How do I get just the first quartile from a column
Asked Answered
You could try this:
#sample data
Means <- runif(100)
#and this is how you get the first quartile
> summary(Means)[2]
1st Qu.
0.2325
Or using function quantile
as per Pascal's comment:
> quantile(Means, 0.25)
25%
0.2324663
Note that you can always use a character reference as well:
summary(Means)[["1st Qu."]]
. –
Costanzo To get just the value of the first quartile, you can do this:
> quantile(Means)[["25%"]]
[1] 0.2209037
© 2022 - 2024 — McMap. All rights reserved.
quantile
and itsprobs
argument. – Tilley