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

Seb*_*eki 6 statistics r

我有一个名为Means的列的数据框.我想从本专栏中获得第一个四分位数.我知道我可以使用四分位数(df)或摘要(df),但这给了我所有的四分位数.我如何才能获得第一个?

Lyz*_*deR 16

你可以试试这个:

#sample data
Means <- runif(100)

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

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

> quantile(Means, 0.25)
      25% 
0.2324663 
Run Code Online (Sandbox Code Playgroud)