0

ボックス プロットが 10 個あります。

 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)

しかし、結果は、男性の手段の点しか得られませんでした。女性はどうなりましたか?

4

1 に答える 1

1

あなたのプロットでは、 への呼び出しはinteraction(Dosis, sex)、線量と性別の 1 つのレベルの組み合わせで因子を生成します。

への呼び出しに同じものを含める必要があります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$

于 2013-05-12T11:58:20.290 に答える