facet_grid problem

12 views
Skip to first unread message

Jacob Etches

unread,
May 25, 2009, 11:47:25 AM5/25/09
to ggp...@googlegroups.com
The following is a plot that used to work (last December, I think with a patched version of ggplot2 from Hadley), but has stopped working with recent updates.  Other instances of facet_grid work and the data look normal to me.  Since I have no idea what caused the error message, I'm having trouble producing a reproducible example or solving the problem.  Has anyone seen this before?

Many thanks,
Jacob Etches


> p <-     qplot(year,prop.excl,data=subset(excl,!is.na(ftf) & exclusion %in%         c("disab_inc_rec","family_death","fs_ch","ft2_ch","retir_inc_rec")),
     geom=c("line"), colour=Exclusion, 
      ylab="Proportion of persons per exposure year",xlab="Start year of exposure window")
> p+ facet_grid(ftf + Sex ~ Age)
Error in rbind(c("spacer", "strip_h", "strip_h", "strip_h", "strip_h",  : 
  number of columns of matrices must match (see arg 2)
In addition: Warning message:
In rbind(list(1, 1, 1, 1, 1, 1), list(0.77705, 1, 1, 1, 1, 0.545041666666667,  :
  number of columns of result is not a multiple of vector length (arg 1)

Raivo Kolde

unread,
May 27, 2009, 2:49:11 AM5/27/09
to ggplot2
Hi

I have exactly the same problem. I would like to use the facetting
with two variables at rows but it keeps throwing me similar error
message. The smallest reproducible example I can get is as follows:

> qplot(mpg, wt, data=mtcars, facets = vs + am ~ . )
Error in rbind(c("spacer", "strip_h", "spacer"), c("axis_v",
"axis_v", :
number of columns of matrices must match (see arg 2)
In addition: Warning message:
In rbind(list(1, 1, 1), list(0.489150267145371, 1,
0.49642448925972, :
number of columns of result is not a multiple of vector length (arg
1)

I'm running R version 2.9.0 and and ggplot2 version 0.8.3

Regards,
Raivo Kolde

hadley wickham

unread,
May 28, 2009, 5:45:43 PM5/28/09
to Raivo Kolde, ggplot2
Sorry about this - it's a known bug which I need to fix.
Regards,
Hadley
--
http://had.co.nz/

Etches Jacob

unread,
May 28, 2009, 9:32:04 PM5/28/09
to ggplot2
Thanks Hadley. Is there a work-around? I'm still not sure what
triggers the problem.

jacob

hadley wickham

unread,
May 28, 2009, 11:40:42 PM5/28/09
to Etches Jacob, ggplot2
It's when you have multiple variables on side of the facet grid
formula. One work around would be to create a variable that
represents the unique combinations with interaction().

Hadley
--
http://had.co.nz/
Reply all
Reply to author
Forward
0 new messages