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

Reduce NAMESPACE of conversion functions #164

Closed
joshwlambert opened this issue Aug 21, 2023 · 2 comments
Closed

Reduce NAMESPACE of conversion functions #164

joshwlambert opened this issue Aug 21, 2023 · 2 comments
Assignees
Labels
enhancement New feature or request

Comments

@joshwlambert
Copy link
Member

Currently there are a few conversion functions in {epiparameter}:

  • convert_gamma_params
  • convert_gamma_summary_stats
  • convert_geom_params
  • convert_geom_summary_stats
  • convert_lnorm_params
  • convert_lnorm_summary_stats
  • convert_nbinom_params
  • convert_nbinom_summary_stats
  • convert_weibull_params
  • convert_weibull_summary_stats
  • gamma_meansd2shapescale
  • gamma_shapescale2meansd
  • geom_mean2prob
  • geom_prob2mean
  • lnorm_meanlogsdlog2meansd
  • lnorm_meansd2meanlogsdlog
  • nbinom_meandisp2probdisp
  • nbinom_probdisp2meandisp
  • weibull_meansd2shapescale
  • weibull_shapescale2meansd

It was raised in #151 that it would be better to reduce the number of conversion functions and instead have a few general functions that encapsulate this functionality. This will reduce the API of the package, be easier to maintain and scale better if we want to add more conversions in the future.

@joshwlambert joshwlambert added the enhancement New feature or request label Aug 21, 2023
@joshwlambert joshwlambert self-assigned this Aug 21, 2023
joshwlambert added a commit that referenced this issue Aug 21, 2023
joshwlambert added a commit that referenced this issue Aug 21, 2023
joshwlambert added a commit that referenced this issue Aug 21, 2023
@joshwlambert
Copy link
Member Author

When this issue was raised in #151 it was mentioned that the function could be dispatched based on the input with the example:

epiparam() |> 
  mutate(params = convert_summary_stats(prob_distribution, mean, sd))

Therefore, it would be good to check if these conversion functions could be turned into S3 generics and dispatched on <epiparam> and <epidist> objects as well as using the default character string implementation that already works.

@joshwlambert
Copy link
Member Author

PR #165 implements the major change requested in this issue, therefore, I will merge this PR before making the change to implement convert_params() and convert_summary_stats() as S3 generics, and make a new issue for this.

joshwlambert added a commit that referenced this issue Aug 24, 2023
joshwlambert added a commit that referenced this issue Aug 24, 2023
joshwlambert added a commit that referenced this issue Aug 24, 2023
joshwlambert added a commit that referenced this issue Aug 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant