-
Notifications
You must be signed in to change notification settings - Fork 4
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
Use internal checking function to reduce duplication #161
base: main
Are you sure you want to change the base?
Conversation
Thanks. Will review and merge into the latest 0.1.2 release PR #168 is complete (as seems like this is probably best sequence given CRAN submission was in limbo while this PR was added). |
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.
I've reviewed these changes with a mis-specified data input column, i.e. ebola1976_first_30 <- rename(ebola1976_first_30,dates=date)
and found the following issue:
The original check format stops at the assert_names
step with an informative warning, preventing any further checks being evaluated:
checkmate::assert_names(
colnames(data),
must.include = c("date", "cases", "deaths")
)
Error: Assertion on 'colnames(data)' failed: Names must include the elements {'date','cases','deaths'}, but is missing elements {'date'}.
However, the new function seems to hit an error because it stores the output of this check along the way, but then reaches the assert_data_frame
check, which can't be completed:
.check_input_data(data)
Error in `[.data.frame`(data, , c("date", "cases", "deaths")) :
undefined columns selected
I see two potential fixes:
What would you prefer? |
Identified by @adamkucharski
cfr_()
function