[英]means on box plots as symbols with several variables
我有十個箱形圖:
boxplot( Daten$weight~interaction(Daten$Dosis,Daten$sex, drop=TRUE))
並且需要其中的手段,所以我嘗試了:
means<-tapply(Daten$weight, Daten$Dosis, mean)
points(means, pch=5, col="red", lwd=5)
但是結果是,我只得到了男性的平均水平,女性發生了什么?
在您的繪圖中,對interaction(Dosis, sex)
的調用interaction(Dosis, sex)
生成一個將Dosis和性別進行一級組合的因子。
您只需在電話中包含相同的內容即可進行tapply
:
# use of `with` to save typing Daten$ over and over again
means <- with(Daten, tapply(weight, interaction(Dosis, sex), mean))
(注意:對於boxplot
您可以進行boxplot(weight ~ interaction(Dosis, sex, drop=T), dat=Daten)
以保存鍵入所有Daten$
)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.