[R] problem with ggplot2 boxplot, groups and facets

stephen sefick ssefick at gmail.com
Wed May 6 03:21:49 CEST 2009


If you would provide a reproducible example I could tinker.

Stephen Sefick

On Tue, May 5, 2009 at 4:59 PM, Zeljko Vrba <zvrba at ifi.uio.no> wrote:
> I have a following problem:
>
> The call
>
> qplot(wg, v.realtime, data=df.best.medians$gv1, colour=sp,  geom="boxplot")
>
> works nice: for each value of the wg factor I get two box-plots (two levels in
> the sp factor) in different colours, side-by-side, centered at the wg x-axis.
> However, I want to separate the data belonging to different levels of the n
> factor, so I add the facets option:
>
> qplot(wg, v.realtime, data=df.best.medians$gv1, facets = . ~ n,
>  colour=sp, geom="boxplot")
>
> At this point, the things break with more than 50 warnings, here are the
> first few:
>
> 1: In Ops.factor(width, n) : / not meaningful for factors
> 2: In Ops.factor(n, 1) : - not meaningful for factors
> 3: In Ops.factor(2, n) : * not meaningful for factors
> 4: In Ops.factor(d_width, n) : / not meaningful for factors
>
> Interestingly enough, removing the colour option, also produces a boxplot,
> but now the data for the two levels of sp are drawn in the same box, i.e.,
> the following works:
>
> qplot(wg, v.realtime, data=df.best.medians$gv1, facets = . ~ n, geom="boxplot")
>
> but does not plot what I want.
>
> Any suggestions for a workaround?
>
> Thanks.
>
> ______________________________________________
> 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.
>



-- 
Stephen Sefick

Let's not spend our time and resources thinking about things that are
so little or so large that all they really do for us is puff us up and
make us feel like gods.  We are mammals, and have not exhausted the
annoying little problems of being mammals.

								-K. Mullis




More information about the R-help mailing list