[R] Multiple graphs > boxplot

John Kane jrkrideau at inbox.com
Sat Oct 6 18:21:39 CEST 2012


Does something like this make any sense?

library(reshape2)
library(ggplot2)
yy  <-  structure(list(A = c(23, 21, 21, 20, 19, 19), B = c(20, 18, 20, 
19, 20, 18), C = c(15, 15, 15, 12, 13, 13)), .Names = c("A", 
"B", "C"), class = "data.frame", row.names = c(NA, -6L))

y1  <-  melt(yy)  # using reshape2 

ggplot(y1, aes(variable, value))+ geom_boxplot() 

# or

ggplot(y1, aes(variable, value))+ geom_boxplot()  + facet_grid(variable ~ .)




John Kane
Kingston ON Canada


> -----Original Message-----
> From: dagrape at hotmail.com
> Sent: Fri, 5 Oct 2012 18:01:39 +0200
> To: r-help at r-project.org
> Subject: [R] Multiple graphs > boxplot
> 
> 
> 
> Dear all
> 
> I am trying to represent a dependent variable (treatment) against
> different independent variables (v1, v2, v3....v20). I am using the
> following command:
> 
> boxplot(v1~treatment,data=y, main="xxxxxx",xlab="xxxxxx", ylab="xxxxxx")
> 
> However, it provides me only one graph for v1~treatment. For the other
> comparisons, I have to repeat the same command but changing the
> parameters. My intentions is to get different plots in just one sheet
> using only one command. Is it possible to join the same order for all the
> comparisons in only one command?
> 
> Thanks
> David
> 
> 	[[alternative HTML version deleted]]
> 
> ______________________________________________
> 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.

____________________________________________________________
FREE ONLINE PHOTOSHARING - Share your photos online with your friends and family!
Visit http://www.inbox.com/photosharing to find out more!




More information about the R-help mailing list