按R中的均值(而非中位数)对箱线图进行排序 [英] Sort boxplot by mean (and not median) in R

查看:998
本文介绍了按R中的均值(而非中位数)对箱线图进行排序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个简单的箱线图,显示了因子TYPE的得分分布:

I have a simple boxplot, showing the distribution of a score for factor TYPE:

myDataFrame = data.frame( TYPE=c("a","a","b","b","c","c"), SCORE=c(1,1,2,3,2,1) )
boxplot( SCORE~TYPE, data=myDataFrame )

各种类型以它们在数据框中的顺序显示. 我想根据每种类型中SCORE的平均值对箱线图进行排序(在上面的示例中,顺序应为a,c,b).

The various types are shown in the order they have in the data frame. I'd like to sort the boxplot by the mean of SCORE in each TYPE (in the example above, the order should be a,c,b).

有任何提示吗?

推荐答案

这是

这篇关于按R中的均值(而非中位数)对箱线图进行排序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆