Sebastian Zeki
Sebastian Zeki

Reputation: 6874

How do I get just the first quartile from a column

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?

Upvotes: 17

Views: 55166

Answers (2)

Scott Taylor
Scott Taylor

Reputation: 1

To get just the value of the first quartile, you can do this:

> quantile(Means)[["25%"]]
[1] 0.2209037

Upvotes: 0

LyzandeR
LyzandeR

Reputation: 37879

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 

Upvotes: 35

Related Questions