generated from epiverse-trace/packagetemplate
-
Notifications
You must be signed in to change notification settings - Fork 1
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
Allow onset_to_hosp
and onset_to_death
to be NA
#98
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…nd convert NA to closures
…om samples increasing from .cross_check_sim_input
…break into new as_function function (DRYer)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR closes #94 by expanding the options for a user to pass to
onset_to_hosp
oronset_to_death
arguments insim_linelist()
andsim_outbreak()
to now includeNA
. If a user passesNA
to either argument the resulting$date_admission
or$date_death
column in the line list will be populated withNA
s.This change requires some new functions being added to the package:
is_na()
: checks that a R object is a single logicalNA
.cross_check_sim_input()
: similar to.check_sim_input()
but cross-checks theonset_to_*
arguments with the*_risk
arguments to ensure the user has provided consistent input. If not the function will warn or error depending on the combination input by the user and whether incorrect argument specification can be safely ignored with a message to the user.as_function()
: wraps and extends some pre-existing code fromsim_linelist()
andsim_outbreak()
that was input checking the epidemiological distributions (contact_distribution
,infect_period
,onset_to_hosp
andonset_to_death
) and converting them to functions. As this code can now convertNA
intoNA
generating functions the added complexity meant having this code contained in a single function and not (identically) repeated across two simulation functions made sense. (It also provides a better structure to extend for upcoming additions to the number of onset-to-event distributions, see Functionality for time varying CFR and different delays depending on outcome #36).The
.add_hospitalisation()
and.add_death()
functions were updated to accommodate the possibility thatonset_to_hosp
oronset_to_death
could beNA
(technicallyNA
producing functions)..check_sim_input()
is also updated.Tests and documentation are added for new functions, and tests for new
sim_linelist()
functionality are also added.Miscellaneous changes in this PR:
CITATION.cff
fileRoxygenNote
field inDESCRIPTION