Hi Dennis, Thanks for your reply. Answers are below: On Thu, Nov 26, 2009 at 4:14 PM, Dennis Murphy <djmu...@gmail.com> wrote:
> Two questions: > (1) Do you want monthly means (averaged over groups), group means > (averaged over > months), overall average, other??? > I need mean (of nail) for each treatment (trt) at each value of Month (so its a two-way mean). (2) Why do you have month 0 and month 12? That would suggest a 13 month year (at minimum). Actually Month column denotes: Visit at 0th Month, Visit after 1st Month,...,Visit after 12th Month -- so you can safely treat them as factor with 6 levels. > Please let me know if you have any further question, > Thanks, > Peng > > DM > > On Thu, Nov 26, 2009 at 1:00 PM, Peng Cai <pengcaimaill...@gmail.com>wrote: > >> Hi R Users, >> >> I am using following R code to plot a "grouped boxplot". I'm hoping if I >> can >> add MEAN to these boxplots. Data is copied below and attached as text >> file. >> >> install.packages("ggplot2") >> library(ggplot2) >> dta<-read.table("Sample.txt",header=T) >> attach(dta) >> p <- ggplot(dta, aes(factor(month), nail)) >> p + geom_boxplot(aes(fill = factor(trt))) >> >> Data: >> month nail trt >> 6 7.2 1 >> 12 9.3 1 >> 0 5.8 1 >> 1 6 1 >> 2 6.5 1 >> 3 7 1 >> 6 9.1 1 >> 12 7.9 1 >> 0 3.3 1 >> 1 4.9 1 >> 2 1.4 2 >> 3 2.7 2 >> 6 3.7 2 >> 12 9.4 2 >> 0 3.1 2 >> 1 2.7 2 >> 2 5.4 2 >> 3 8.3 2 >> 6 12.3 2 >> 12 17.7 2 >> >> Any help would be greatly appreciated, >> >> Thanks, >> Peng >> >> ______________________________________________ >> R-help@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. >> >> > [[alternative HTML version deleted]] ______________________________________________ R-help@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.