hadley/ggplot2 — pull request #702 by wch (2012-10-24 02:44:52+00:00)
Title: Fix density

This partially fixes #676. It fixes the first case, where there are some groups with >= 3 points. But there are still errors if all groups have < 3 points. This is because `StatDensity$calculate` returns an empty data frame with no y values to train the scale. I'm not sure what the proper solution is. Maybe return a data frame with `y=0`?

For the fix that I've done so far, I had to infer the correct behavior of `finite.cases()`. @hadley, it would be good if you could look at the tests I wrote to check if I was right.