epiverse-trace / epiparameter

R package with library of epidemiological parameters for infectious diseases and functions and classes for working with parameters
https://epiverse-trace.github.io/epiparameter
Other
33 stars 11 forks source link

Clean probability distribution name internal to resolve case sensitive matching issue #376

Closed joshwlambert closed 2 months ago

joshwlambert commented 2 months ago

This PR addresses #375 by cleaning the probability distribution name internally. This resolves an issue whereby the resulting <epiparameter> would be unparameterised due to not matching the string to construct the distribution object to be stored in the <epiparameter> object.

The fix applied in this PR now means the prob_distribution argument is now insensitive to case and whitespace, e.g.

library(epiparameter)
epiparameter::epiparameter(
  disease = "Mpox", 
  epi_dist = "serial interval", 
  prob_distribution = " WeiBull  ", 
  prob_distribution_params = c(shape = 2, scale = 2), 
  citation = create_citation(
    author = "James Smith", 
    year = 2000, 
    title = "Mpox stuff", 
    journal = "Journal of Epi", 
    doi = "10.2812ha"
  )
)
#> Using Smith J (2000). "Mpox stuff." _Journal of Epi_. doi:10.2812ha
#> <https://doi.org/10.2812ha>. 
#> To retrieve the citation use the 'get_citation' function
#> Disease: Mpox
#> Pathogen: NA
#> Epi Distribution: serial interval
#> Study: Smith J (2000). "Mpox stuff." _Journal of Epi_. doi:10.2812ha
#> <https://doi.org/10.2812ha>.
#> Distribution: weibull
#> Parameters:
#>   shape: 2.000
#>   scale: 2.000

Created on 2024-09-13 with reprex v2.1.0