我有一个数据集(测试),如下所示:
Type    Met1    Met2    Met3    Met4
TypeA   65  43  97  77
TypeA   46  25  76  77
TypeA   44  23  55  46
TypeA   46  44  55  77
TypeA   33  22  55  54
TypeB   66  8   66  47
TypeB   55  76  66  65
TypeB   55  77  88  46
TypeB   36  67  55  44
TypeB   67  55  76  65
我已经检查了很多关于箱线图的链接,但是对于我想要的箱线图类型,我仍然没有成功。我希望为所有大都会(Met1、Met2、Met3、Met4)制作一个箱线图,其中我的 X 轴具有 A 型(黄色、橙色)。本质上,我想要以下内容(取自此处):
我正在尝试类似的东西,
boxplot(formula = len ~ Type , data = test, subset == "TypeA")
boxplot(formula = len ~ Type , data = test, subset == "TypeA", add=TRUE)
Legend(legend = c( "typeA", "typeB" ), fill = c( "yellow", "orange" ) )
但我无法用它来解决它。谁能帮助我知道如何以正确的方式在我的测试数据上制作这样的箱线图?


