[R] Need help on boxplot panel chart

hadley wickham h.wickham at gmail.com
Mon Feb 15 15:25:23 CET 2010


Hi Doug,

Could you please provide a reproducible example?  It's difficult to
diagnose the problem without one.

Hadley

On Fri, Feb 12, 2010 at 2:46 PM, DougNiu <dhua at umn.edu> wrote:
>
> Hi there:
>
> I am new to R and creating a boxplot panel chart to show a test result.
>
> I have four output variables (OV1, OV2, OV3, OV4) reflecting effects of the
> variation of three status parameters (SP1, SP2, SP3) on them at three
> different locations (Loc1, Loc2, Loc3). My plan is that displaying ONE OV
> change with ONE SP over three Loc in each boxplot (i.e., Loc is X axis and
> OV value is Y axis). Because there are three SP, I may need total of 12
> boxplots to show the changes of OVs with SPs.
>
> However,  I met a problem when I used the following R code:
>
> p1 <- ggplot(OV.m, aes(Loc, value, ymin=value, ymax = value,
> colour="grey20"))+
> +
> scale_colour_identity()+facet_grid(variable~.,scales="free",as.table=FALSE)+
> + theme_bw()+opts(panel.margin=unit(0,"lines")
>
> where variable is the title of a column in OV.m (OV.m is melted from OV,
> original data table); value is OV value for different SP. After I used p2 <-
> p1 + geom_boxplot(), I found R calculated each boxplot across range of OVs
> instead of calculating boxplot by OV1, OV2,... , OV4 individually. I only
> got three boxplots instead of 12.
>
> Can any body tell me how to make OV boxplot by OV1, OV2, OV3, OV4 and SP1,
> SP2, SP3? Thank you!
>
>
>
> --
> View this message in context: http://n4.nabble.com/Need-help-on-boxplot-panel-chart-tp1490406p1490406.html
> Sent from the R help mailing list archive at Nabble.com.
>
>        [[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.
>



-- 
Assistant Professor / Dobelman Family Junior Chair
Department of Statistics / Rice University
http://had.co.nz/



More information about the R-help mailing list