hadley/ggplot2 — Issue #247: Data with alot of zeros, a boxplot and scale log2 fail
Author: apepper
Created: 2011-10-17 19:51:35+00:00
State: open

Hi there.
When I have a dataframe, that contains alot of zeros so all quartiles are zero and no outliers exists, ggplot2 fails when trying to run it with a log2 scale. Without the log2 scale it works fine. I'm running `R version 2.13.2` and `ggplot2 Version: 0.8.9`.

# Minimal Example:
library(ggplot2)

DF <- data.frame(
time = factor(c(1,2,1,2,1,2,1,2,1,2)),
value = c(0,0,0,0,0,0,0,0,0,10))

ggplot(DF, aes(time, value)) + geom_boxplot() + scale_y_log2()

# Error Message (parts in german):
Fehler in if (any(outliers)) stats[c(1, 5)] <- range(y[!outliers], na.rm = TRUE) :
Fehlender Wert, wo TRUE/FALSE nötig ist