epiverse-trace / simulist

An R package for simulating line lists
https://epiverse-trace.github.io/simulist/
Other
4 stars 0 forks source link

Vectorise `.add_hospitalisation()` #150

Closed joshwlambert closed 4 days ago

joshwlambert commented 4 days ago

This PR addresses #125 by vectorising the internal function .add_hospitalisation(). It follows the same vectorisation and interval finding approach as .add_outcome() implemented in #101.

The previous version .add_hospitalisation() looped over a sample(), whereas the new changes made in this PR use a vectorised rbinom() call so there will likely be a different number of random samples in the simulation between versions. This is the reason that the sim_linelist() and sim_outbreak() snapshots for unit tests needed updating. Only the columns of the linelist that are randomly generated after .add_hospitaliation() have changed.