Re: [R] Boxplot questions.

From: Petr Pikal <petr.pikal_at_precheza.cz>
Date: Tue 27 Jun 2006 - 22:33:06 EST


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@yahoo.com>
To:             	r-help@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@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide!
> http://www.R-project.org/posting-guide.html

Petr Pikal
petr.pikal@precheza.cz



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Tue Jun 27 22:38:02 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Wed 28 Jun 2006 - 00:12:05 EST.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.