如何从列中获取第一个四分位数

How do I get just the first quartile from a column

我有一个数据框,其中有一列名为“均值”。我只想从该列中获取第一个四分位数。我知道我可以使用四分位数 (df) 或摘要 (df),但这给了我所有的四分位数。我如何获得第一个?

你可以试试这个:

#sample data
Means <- runif(100)

#and this is how you get the first quartile
> summary(Means)[2]
1st Qu. 
 0.2325 

或根据 Pascal 的评论使用函数 quantile

> quantile(Means, 0.25)
      25% 
0.2324663