Skip to content
Prev 257173 / 398506 Next

Odp: boxplot with 2 treatments and 2 variables (with 2 corresponding y-axes)

Hi

r-help-bounces at r-project.org napsal dne 15.04.2011 16:20:23:
I am
like
have
seperate
make a
each
that
Here is one option

x<-rnorm(10)
y<-rnorm(10)+5
trt<-sample(letters[1:2], 10, replace=T)
df<-cbind(c(x,y), rep(trt,2), rep(c("v1","v2"), each=10))
df<-as.data.frame(df)
df[,1]<-as.numeric(as.character(df[,1]))
boxplot(split(df[,1], interaction(df[,2], df[,3])))
 
however you have only one y axis. Similar result but better structured you 
can get using ggplot2 or lattice packages.

Having 2 y axes is rather confusing but you can scale your values and add 
axis annotation with
axis(....) but I doubt it is worth an effort.

Regards
Petr
http://www.R-project.org/posting-guide.html
Message-ID: <OF946C9CE6.A044EE44-ONC1257876.0022639C-C1257876.0023D0A0@precheza.cz>
In-Reply-To: <72E6FB2B1F58B344A686277A2BE2BBC514E16864C4@EXCHMBS02.isad.isadroot.ex.ac.uk>