[R] help with creating a box plot

Bert Gunter gunter.berton at gene.com
Fri May 18 20:02:49 CEST 2012


Have you read "An Introduction to R" ?  This is a pretty basic
exercise that you should be able to do by yourself if you have. If you
haven't, you need to (or some other basic R tutorial -- there are many
around).

-- Bert

On Fri, May 18, 2012 at 10:41 AM, Adrian Johnson
<oriolebaltimore at gmail.com> wrote:
> Hi:
>
> I am looking for some help in making two boxplots next to each other.
>
>
> I have a data like this:
>
> N1   T1   N2   T2   N3   T3   N4   T4  ... Nn  Tn
> 7     8.2   4     5     8    10    4     5 .....  10   11
>
> I want to have box plot for all Normal samples (N1,N2,N3,N4,,,,Nn)
> and another box plot for all tumors (T1,T2,T3,T4,...Tn).
>
> I have data in a numeric class.
>
>
> If data is represented as N1 N2 N3 N4 T1 T2 T3 T4 I can do something
> like the following:
>
> if x object is my data matrix
>
> boxplot(x ~ c(rep('N',n),rep('T',n)), ylim=ylim, main=title)
>
>
> since the data is arranged as N1 T1, I don't know how to use boxplot
> function on tumor-normal lable.
>
>  Could any one help me please.
> thanks
> Adrian
>
> ______________________________________________
> 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.



-- 

Bert Gunter
Genentech Nonclinical Biostatistics

Internal Contact Info:
Phone: 467-7374
Website:
http://pharmadevelopment.roche.com/index/pdb/pdb-functional-groups/pdb-biostatistics/pdb-ncb-home.htm



More information about the R-help mailing list