maggy yan
2013-May-12 00:57 UTC
[R] need means on all boxplots, but only half of them got that
I tried to draw a point on all boxplots for their means, I did: 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) but only the boxplots for male got that point on them, its really weird because I don't think that I separated the sex in the codes above [[alternative HTML version deleted]]
Hi, ? If the means are based on the combination. means<-tapply( Daten$weight, list(Daten$Dosis,Daten$sex), mean) library(reshape2) points(melt(means)$value,pch=5,col="red",lwd=5) A.K. ----- Original Message ----- From: maggy yan <kiotoqq at gmail.com> To: R-help at r-project.org Cc: Sent: Saturday, May 11, 2013 8:57 PM Subject: [R] need means on all boxplots, but only half of them got that I tried to draw a point on all boxplots for their means, I did: 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) but only the boxplots for male got that point on them, its really weird because I don't think that I separated the sex in the codes above ??? [[alternative HTML version deleted]] ______________________________________________ R-help at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
S Ellison
2013-May-14 21:20 UTC
[R] need means on all boxplots, but only half of them got that
________________________________________>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) > > ...only the boxplots for male got that point on them, > its really weird because I don't think that I separated the sex in the codes aboveLook again; the boxplot is clearly distinguished by sex. Try means<-tapply( Daten$weight, interaction(Daten$Dosis,Daten$sex, drop=TRUE), mean) S Ellison ******************************************************************* This email and any attachments are confidential. Any use...{{dropped:8}}