Re: [R] Faceted bar plot shows wrong counts (ggplot2)

2012-04-11 Thread Hadley Wickham
And it's now fixed in the dev version. Hadley On Tue, Mar 13, 2012 at 11:37 AM, Helios de Rosario wrote: > Michael, > > Thanks for the pointer to the discussion in the ggplot list. It seems > that the reason of this behaviour of facet_grid() is already known and > being discussed by the developer

Re: [R] Faceted bar plot shows wrong counts (ggplot2)

2012-03-13 Thread Helios de Rosario
Michael, Thanks for the pointer to the discussion in the ggplot list. It seems that the reason of this behaviour of facet_grid() is already known and being discussed by the developers of ggplot2. facet_grid() reduces the original data frame with unique() before applying the stats. If the data fr

Re: [R] Faceted bar plot shows wrong counts (ggplot2)

2012-03-12 Thread R. Michael Weylandt
You get the "good" behavior with base + aes(x = cut) + facet_wrap(~ color, ncol = 5) so this seems buggy to me. If someone here doesn't step forward with more insight, I'd forward it to the ggplot list to see if one of the developers there can give an explanation or possibly make the official ca

[R] Faceted bar plot shows wrong counts (ggplot2)

2012-03-12 Thread Helios de Rosario
I have encountered a problem with faceted bar plots. I have tried to create something like the example explained in the ggplot2 book (see pp. 126-128): library(ggplot2) mpg4 <- subset(mpg, manufacturer %in% c("audi", "volkswagen", "jeep")) mpg4$manufacturer <- as.character(mpg4$manufacture