Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I get just the first quartile from a column

Tags:

r

statistics

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?

like image 921
Sebastian Zeki Avatar asked Sep 01 '15 10:09

Sebastian Zeki


People also ask

How do you find the 1st quartile of a set of data?

Take the median of the lower half of the data set. The median of this set is the value of the first quartile.


1 Answers

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 
like image 97
LyzandeR Avatar answered Oct 16 '22 03:10

LyzandeR