Skip to content

stat_bin() accepts functions for breaks #4560

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

Closed
wants to merge 1 commit into from

Conversation

aijordan
Copy link
Contributor

Allowing breaks in stat_bin() to accept functions is useful in the context of grouping structures. Particularly, when data are mixed discrete and continuous, e.g., precipitation.

The changes also enable facet histograms for estimators with variable bin width, e.g, equal area of all blocks, or the "essential histogram" (doi:10.1093/biomet/asz081).

This PR is in the same spirit as #1890

@aijordan aijordan marked this pull request as ready for review July 22, 2021 15:00
@clauswilke
Copy link
Member

Please open an issue before creating a PR, so we can discuss.

@teunbrand
Copy link
Collaborator

Is there any change we could revive this PR? If not, I can fix the issue in a different PR.
I think the content of the PR looks good, but PR might need to be re-targetted from the 'master' branch to the 'main' branch and merge in latest changes.

@aijordan
Copy link
Contributor Author

I'd be happy to recreate the PR. I cannot reopen or change the base, it seems.

@teunbrand
Copy link
Collaborator

Yeah that'd be great, thanks!
If you were to recreate it, I'd slightly adapt the wording so that it is clearer what the function input/output it, something like:

Can also be a function that takes group-wise values as input and returns bin boundaries.

I think scale transformation has already been applied once it arrives at break calculation, so that part can be omitted I think.

@aijordan
Copy link
Contributor Author

aijordan commented Jun 27, 2024

I believe the comment about scale transformation was essentially copied from the argument description for binwidth. I suppose it could or should be removed there as well!?

@teunbrand
Copy link
Collaborator

I'll open an issue about the binwidth docs, they appear incorrect. You can leave it as-is for now, as it is unrelated to the changes proposed in this PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants