Skip to content

help wth boxplots

3 messages · Amit Patel, PIKAL Petr, Michael Lawrence

#
Hi

I have a vector of data lets call zz (40 values from 4 samples)
the data is already in groups, i can even split up the samples using

SampA <- zz[,2:11]
SampB <- zz[,12:21]
SampC <- zz[,22:31]
SampV <- zz[,32:41]

I would like an output that gives me 4 boxplots on one plot
one boxplot for the set of 10 values

how can i do this in R
#
Hi
r-help-bounces at r-project.org napsal dne 26.05.2009 15:34:25:
Are you sure it is a vector? Your indexing suggest data frame or matrix.
maybe

boxplot(list(SampA, SampB, SampC, SampV))

but there are more effective ways if you had other data structure

e.g.

4 column data frame

boxplot(data.frame(rnorm(10), rnorm(10), rnorm(10), rnorm(10)))

or list

boxplot(list(rnorm(10), rnorm(10), rnorm(10), rnorm(10)))
or even a vector of indices for different groups

boxplot(split(rnorm(40), rep(letters[1:4],10)) 

Regards
Petr
http://www.R-project.org/posting-guide.html
#
check out ggplot2:
http://had.co.nz/ggplot2/

particularly:
http://had.co.nz/ggplot2/geom_boxplot.html
On Tue, May 26, 2009 at 10:34 AM, Amit Patel <amitrhelp at yahoo.co.uk> wrote: