Skip to content

Fix guide_bins() when the data has no size #3593

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

Conversation

yutannihilation
Copy link
Member

Fix #3582

The result of do.call("cbind", lapply(guide$geoms, function(g) g$data$size / 10)) can be an empty matrix, which cannot be subsetted. I guess the branch if (nrow(key_size_mat) == 0 || ncol(key_size_mat) == 0) { is prepared to handle this.

@clauswilke
Copy link
Member

Do you want to add a small comment about the empty matrix issue to the code? I generally think that whenever we identify these kinds of potential problems, it makes sense to point them out in the code, so somebody else doesn't repeat the mistake in the future.

@yutannihilation
Copy link
Member Author

Thanks, I will.

Copy link
Member

@thomasp85 thomasp85 left a comment

Choose a reason for hiding this comment

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

LGTM

@yutannihilation
Copy link
Member Author

Thanks.

@yutannihilation yutannihilation merged commit bad6f38 into tidyverse:master Nov 4, 2019
@yutannihilation yutannihilation deleted the fix/issue-3582-guide-bin-no-sizes branch November 4, 2019 09:37
@lock
Copy link

lock bot commented May 5, 2020

This old issue has been automatically locked. If you believe you have found a related problem, please file a new issue (with reprex) and link to this issue. https://reprex.tidyverse.org/

@lock lock bot locked and limited conversation to collaborators May 5, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Report a bug of guide-bins: it cannot work with geom_sf.
3 participants