Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updates to include count & density to fix the use of geom_hexbin #1688

Closed
wants to merge 13 commits into from
2 changes: 2 additions & 0 deletions R/hexbin.R
Expand Up @@ -31,6 +31,8 @@ hexBinSummarise <- function(x, y, z, binwidth, fun = mean, fun.args = list(), dr

# Convert to data frame
out <- as.data.frame(hexbin::hcell2xy(hb))
out$count = as.vector(hb@count)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please use <- instead of =?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also I'm not sure that the code should go here - it's only needed for hexbin, not the other summary functions.

out$density = as.vector(hb@count / sum(hb@count, na.rm = TRUE))
out$value <- as.vector(value)

if (drop) out <- stats::na.omit(out)
Expand Down