Google Groups

Re: Error in if (!all(data$ymin == 0)) warning("Stacking not well defined when ymin != 0", : missing value where TRUE/FALSE needed


Hadley Wickham May 5, 2010 2:57 PM
Posted in group: ggplot2
If you're not stacking, you can probably fix this by specifying
position = "identity", otherwise I'll need a reproducible example to
track down the bug.

Thanks!

Hadley

On Wed, May 5, 2010 at 4:51 PM, David Young <dyo...@telefonica.net> wrote:
> I was using the following code successfully until I added a vast
> quantity of data.  At which point I started getting the error:
>
> Error in if (!all(data$ymin == 0)) warning("Stacking not well defined when ymin != 0",  :
>  missing value where TRUE/FALSE needed
>
> My function (graph8by2) just uses the summary function to create some
> factors and the creates a faceted bar chart.  I'm fairly new and don't
> really understand what the error is telling me and I can't really send
> a sample of the data since it worked when it was small and doesn't now
> that it's big.  Anyway I just thought if anyone had a guess as to
> where I should begin looking for problems in the morning (I live in
> Spain) then that'd be helpful.  Thanks in advance to any responders.
>
> I probably should mention that I did get the warning about "Stacking
> not well defined" earlier, but since I wasn't stacking the bars and
> the graphs appeared to be coming out fine I ignored it.  The "missing
> value where TRUE/FALSE needed" is new but the variables have always
> had some missing values so it is not really clear what that means or
> what is different.
>
> graph8by2 <- function( var1, var2, dep, data) {
>
>  temp1 <- summary(data[,var1])
>  temp2 <- summary(data[,var2])
>  fac1 <- factor(cut(data[,var1] ,
>    breaks=c(temp1["Min."], temp1["1st Qu."]-((temp1["Median"]-temp1["1st Qu."])/2),
>             temp1["1st Qu."], temp1["Median"]-((temp1["Median"]-temp1["1st Qu."])/2),
>             temp1["Median"], temp1["Median"]+((temp1["3rd Qu."]-temp1["Median"])/2),
>             temp1["3rd Qu."], temp1["3rd Qu."]+((temp1["3rd Qu."]-temp1["Median"])/2),
>             temp1["Max."]) ))
>  fac2 <- factor(cut(data[,var2] ,
>    breaks=c(temp2["Min."], temp2["1st Qu."]-((temp2["Median"]-temp2["1st Qu."])/2),
>             temp2["1st Qu."], temp2["Median"]-((temp2["Median"]-temp2["1st Qu."])/2),
>             temp2["Median"], temp2["Median"]+((temp2["3rd Qu."]-temp2["Median"])/2),
>             temp2["3rd Qu."], temp2["3rd Qu."]+((temp2["3rd Qu."]-temp2["Median"])/2),
>             temp2["Max."]) ))
>
>  temp3 <- aggregate(data[, dep] ,
>    list( var1 =fac1, var2 =fac2),
>    mean)
>  temp4 <- aggregate(data[, dep] ,
>    list( var1 =fac1, var2 =fac2 ),
>    length)
>  temp4 <- as.vector(temp4$x)
>
>  temp3$sample.size <- factor(cut(temp4 ,  breaks=c(0, 100, 1000, 5000, 1000000 ) ))
>
>  qplot(var1, x, fill= sample.size, geom="bar", facets= var2 ~ . ,  data= temp3,
>    xlab = var1 , ylab = paste(dep," faceted by ", var2) ,
>    main = paste(dep, "\n by", var1, ",", var2) )
> }
>
>
>
>
>
> --
> Best regards,
>
> David Young
> Marketing and Statistical Consultant
> Madrid, Spain
> +34 913 540 381
> http://www.linkedin.com/in/europedavidyoung
>
>                          mailto:dyo...@telefonica.net
>
> --
> You received this message because you are subscribed to the ggplot2 mailing list.
> Please provide a reproducible example: http://gist.github.com/270442
>
> To post: email ggp...@googlegroups.com
> To unsubscribe: email ggplot2+u...@googlegroups.com
> More options: http://groups.google.com/group/ggplot2
>



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

--
You received this message because you are subscribed to the ggplot2 mailing list.
Please provide a reproducible example: http://gist.github.com/270442

To post: email ggp...@googlegroups.com
To unsubscribe: email ggplot2+u...@googlegroups.com
More options: http://groups.google.com/group/ggplot2