[R] Odp: help wth boxplots

Petr PIKAL petr.pikal at precheza.cz
Tue May 26 16:11:38 CEST 2009


Hi
r-help-bounces at r-project.org napsal dne 26.05.2009 15:34:25:

> 
> Hi
> 
> I have a vector of data lets call zz (40 values from 4 samples)

Are you sure it is a vector? Your indexing suggest data frame or matrix.

> 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

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

> 
> 
> 
> ______________________________________________
> 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.




More information about the R-help mailing list