我画了一张每年PM2.5水平的框图。
Boxplot(PM2.5~year, data=subset(dat, hour==12), las=1)如何从箱线图中提取中位数之类的值?
发布于 2020-03-30 18:08:54
默认的boxplot函数以不可见的方式返回汇总,您只需将其赋给一个变量:
res <- boxplot(Sepal.Length ~ Species, data=iris)在res中存在一个元素stats
> res$stats
[,1] [,2] [,3]
[1,] 4.3 4.9 5.6
[2,] 4.8 5.6 6.2
[3,] 5.0 5.9 6.5
[4,] 5.2 6.3 6.9
[5,] 5.8 7.0 7.9这些是方框的四分位数摘要。中间是中间的,所以:
> res$stats[3,]
[1] 5.0 5.9 6.5https://stackoverflow.com/questions/60928195
复制相似问题