-
Notifications
You must be signed in to change notification settings - Fork 66
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
Check prop
argument
#551
Check prop
argument
#551
Conversation
check_prop <- function(prop, replace) { | ||
acceptable_prop <- is.numeric(prop) | ||
acceptable_prop <- acceptable_prop && | ||
((prop <= 1 && replace) || (prop < 1 && !replace)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This distinction between what the upper boundary can be is removed because we are using it only in group_boot_splits()
:
Lines 264 to 265 in fe24aaa
prop = 1, | |
replace = TRUE, |
We know where this particular
prop = 1
is coming from and that it's okay in this context so the new check_prop()
can just check user input.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
saaaaaaaatisfying
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Upgrade! Up! Grade!
check_prop <- function(prop, replace) { | ||
acceptable_prop <- is.numeric(prop) | ||
acceptable_prop <- acceptable_prop && | ||
((prop <= 1 && replace) || (prop < 1 && !replace)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
saaaaaaaatisfying
Co-authored-by: Simon P. Couch <[email protected]>
This pull request has been automatically locked. If you believe you have found a related problem, please file a new issue (with a reprex: https://reprex.tidyverse.org) and link to this issue. |
For #541 and #458
This PR reworks how the
prop
argument to various functions is checked.Several of the functions had a written-out check block in either the user-facing function or the underlying
*_split()
function. The functions for grouped resampling were checkingprop
deep down the call chain with acheck_prop()
.I've decided to place the check in the user-facing functions and reworked it a little to benefit from the "friendly object type" in the standard checkers from rlang and only do the boundaries in a custom way.