generated from epiverse-trace/packagetemplate
-
Notifications
You must be signed in to change notification settings - Fork 2
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
Stricter input checking for proportion_transmission()
#102
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
…on_cluster_size to better print values close to zero
…ortion_transmission
…ansmission must be greater than zero
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 tightens up the input checking in
proportion_transmission()
.proportion_transmission()
now errors when:percent_transmission
argument is equal to 0 or 1. Previouslypercent_transmission
could be greater or equal to 0 and lesser than or equal to 1. When equal to 0 or 1, the function would produce invalid results (e.g.NaN
) or would not produce sensible results due to numeric imprecision (e.g.percent_transmission = 0
whenmethod = "t_20"
was > 0). Whenpercent_transmission
was equal 1 the function would error whenmethod = "t_20"
and results formethod = "p_80"
would vastly differ depending on ifsimulate
wasTRUE
orFALSE
.k
is equal to 0. This produce errors weird behaviour similar to those outlined forpercent_transmission
.Infinite values of
k
are approximated by setting them to1e5
. This was again due to errors and invalid results due to the inability of the internalproportion_transmission()
methods not being able to work withInf
values.The formatting of the
proportion_transmission()
andproportion_cluster_size()
(whenformat_prop = TRUE
which is the default) is now printed to 3 significant figures, rather than rounding, as values close to zero were being rounded to zero which could mislead users.A new
%gt%
operator is added to the package to provide a succinct way to check if numeric variables are above a certain value and if so set than to the value with a message to the user. This operator is used in.prop_transmission_t20()
.Unit tests are added to check the new input checking and variable setting, as well as for
%gt%
.