-
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
set risks to NA
if processes not desired
#146
Comments
I think this and #147 are meant to be posted on |
The I'd prefer not to remove the default value for the |
How about something like if (is.null(onset_to_hosp) && missing(hosp_risk)) {
hosp_risk <- NULL
} and add to the documentation that |
I would like to keep the default values for the The choice as I see it is between A) No warning to users if (is.null(onset_to_hosp)) {
hosp_risk <- NULL
} B) Warn users that if (is.null(onset_to_hosp) && !is.null(hosp_risk)) {
warning(...)
hosp_risk <- NULL
} Whichever option is chosen I will improve the documentation. |
I'm not completely following - my suggestion would allow you to keep the default but warn if set by a user if they also set |
This is a good solution, but how do you know if For example if Phrased another way, is there a way to know if a user has supplied a value to an argument if that argument has a default ( This was written without fully understanding the behaviour of |
First and foremost apologies, I didn't understand the functionality of func <- function(x = 1) {
print(x)
if (missing(x)) {
return("it is missing")
} else {
return("it is not missing")
}
}
func()
#> [1] 1
#> [1] "it is missing" func(x = 2)
#> [1] 2
#> [1] "it is not missing" Created on 2024-07-01 with reprex v2.1.0 I'll implement the changes you suggested using (Sorry, this wouldn't have taken much less back-and-forth if my knowledge of R was better). |
No worries, and clearly not the most obvious behaviour! |
Setting
onset_to_hosp
to NA yields a warningI think it should be either documented with the
onset_to_hosp
argument that this has to be done manually, or (my preference)hosp_risk
should be set automatically if it is not specified (can usemissing()
) andonset_to_hosp
is not wanted.The text was updated successfully, but these errors were encountered: