d <- ggplot(diamonds, aes(carat, price)) + xlim(1,3)
d + stat_density2d(geom="tile", aes(fill = ..density..), contour =
FALSE)
I get the error message
Error in `[<-.data.frame`(`*tmp*`, var, value = list(`NA` = NULL)) :
missing values are not allowed in subscripted assignments of data
frames
Changing line 31 in stat-density-2d.r from
names(df) <- c("x", "y", "density")
to
names(df) <- c("x", "y", "density","group")
fixes the problem and produces output similar to the documentation.
Was alerted to this by the following stackoverflow question
http://stackoverflow.com/questions/2333521/why-do-i-get-an-error-when-i-run-some-examples-from-the-online-ggplot2-reference
Jyotirmoy Bhattacharya
Sorry for the previous post. Found out that it was a known bug:
http://groups.google.com/group/ggplot2/browse_thread/thread/6a7929d2b122efb2
Jyotirmoy Bhattacharya