-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Only use finite breaks for computing fuzz #5668
Conversation
R/bin.R
Outdated
check_numeric(breaks) | ||
fuzz <- fuzz %||% 1e-08 * stats::median(diff(breaks[is.finite(breaks)])) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what happens if there is only one finite break?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Currently, it throws an error. I guess a not unreasonable approach would be to set the fuzz to a very small number?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah, I'd be fine with that, but we should not throw error at least
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
This PR aims to fix #5665.
Briefly, when histogram
breaks
are short and contain non-finite values, the median difference between breaks can becomeInf
.In this PR, we only use finite breaks to compute the median difference for the fuzz-factor.
Reprex from #5665
Created on 2024-01-30 with reprex v2.1.0