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

Add as.function() method for <epidist> #215

Merged
merged 3 commits into from
Nov 29, 2023
Merged

Add as.function() method for <epidist> #215

merged 3 commits into from
Nov 29, 2023

Conversation

joshwlambert
Copy link
Member

This PR adds a new S3 method for the <epidist> class: as.function(). as.function() is a base R generic function.

This function is added to allow users to easily create functions that take a single argument and is parameterised with the <epidist> object. It currently works for PDF/PMF, CDF, RNG and quantiles.

It is enables other R packages that use {epiparameter} to access either <epidist> objects or lambda (anonymous) functions and then convert the <epidist> into a function where needed so the two methods can be used interchangably.

Tests are added for as.function.epidist() and the NAMESPACE is updated.

A seed is added to the test comparing sysdata.rda with .read_epidist_db().

@joshwlambert joshwlambert merged commit d33b20d into main Nov 29, 2023
9 checks passed
@joshwlambert joshwlambert deleted the epidist_as_func branch November 29, 2023 14:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant