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

added as.character() and duplicated() methods #106

Merged
merged 1 commit into from
Sep 3, 2024
Merged

Conversation

zeileis
Copy link
Collaborator

@zeileis zeileis commented Sep 3, 2024

Alex @alexpghayes, this is a very small PR, adding two basic methods for distribution objects:

  • Added an as.character() method which essentially calls format(..., digits = 15, drop0trailing = TRUE). This mimics the behavior and precision of base R for real vectors. Note that this enables using match() for distribution objects.
  • Added a duplicated() method which relies on the corresponding method for the data.frame of parameters in a distribution.

In R-devel this allows to use sets operations on distributions like union(), intersect(), setdiff(), %in%, etc.

@zeileis zeileis mentioned this pull request Sep 3, 2024
@alexpghayes alexpghayes merged commit 0791b6d into main Sep 3, 2024
11 checks passed
@zeileis zeileis deleted the add-methods branch September 3, 2024 20:33
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.

2 participants