Dear all, I am having a data for 2 different treatments with different time points. So, I used the following code to plot the boxplot and also to do anova. T11 <- c(280, 336, 249, 277, 429) T12 <- c(400, 397, 285, 407, 313) T13 <- c(725, 373, 364, 706, 249) T21 <- c(589, 257, 466, 248, 913) T22 <- c(519, 424, 512, 298, 907) T23 <- c(529, 479, 634, 354, 1015) obs <- c(T11, T12, T13, T21, T22, T23) treat <- c(rep("T1",15), rep("T2",15)) time <- c(rep("one",5), rep("two",5), rep("thr",5), rep("one",5), rep("two",5), rep("thr",5) ) table <- data.frame(obs, treat, time) boxplot(obs ~ treat*time, data=table) I am able to produce a boxplot for the above data. (1) If I want to add a color to T1 and different color to T2, what are the options I should use? (2) my prof. asked me to add '*' above the boxplot, if the comparison is significant. How do I add this '*' in the boxplot? I used: anova(lm(obs ~ treat*time, data=table)) for finding significance. Any help is greatly appreciated. Thanks in advance. Regards, Ezhil
Hi HTH Petr On 27 Jun 2006 at 4:45, A Ezhil wrote: Date sent: Tue, 27 Jun 2006 04:45:01 -0700 (PDT) From: A Ezhil <ezhil02 at yahoo.com> To: r-help at stat.math.ethz.ch Subject: [R] Boxplot questions.> Dear all, > > I am having a data for 2 different treatments with > different time points. So, I used the following code > to plot the boxplot and also to do anova. > > T11 <- c(280, 336, 249, 277, 429) > T12 <- c(400, 397, 285, 407, 313) > T13 <- c(725, 373, 364, 706, 249) > > T21 <- c(589, 257, 466, 248, 913) > T22 <- c(519, 424, 512, 298, 907) > T23 <- c(529, 479, 634, 354, 1015) > > obs <- c(T11, T12, T13, T21, T22, T23) > treat <- c(rep("T1",15), rep("T2",15)) > time <- c(rep("one",5), rep("two",5), rep("thr",5), > rep("one",5), rep("two",5), rep("thr",5) > ) > > table <- data.frame(obs, treat, time) > boxplot(obs ~ treat*time, data=table) > > I am able to produce a boxplot for the above data. > (1) If I want to add a color to T1 and different color > to T2, what are the options I should use?from help page border an optional vector of colors for the outlines of the boxplots. The values in border are recycled if the length of border is less than the number of plots. col if col is non-null it is assumed to contain colors to be used to colour the bodies of the box plots. By default they are in the background colour. > boxplot(obs ~ treat*time, data=table, border=rep(1:3,each=2))> (2) my prof. asked me to add '*' above the boxplot, if > the comparison is significant. How do I add this '*' > in the boxplot?see bxp and try bbb<- boxplot(.....) and look at bbb. You can derive positions of boxes from it and put any text e.g. asterix according to these positions. HTH Petr> > I used: anova(lm(obs ~ treat*time, data=table)) for > finding significance. > > Any help is greatly appreciated. Thanks in advance. > > Regards, > Ezhil > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide! > R-project.org/posting-guide.htmlPetr Pikal petr.pikal at precheza.cz