-
Notifications
You must be signed in to change notification settings - Fork 12
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
Tools for input checking in functions #149
Comments
Also a good place to talk about https://github.com/ropensci-review-tools/autotest as a way to control you check your inputs correctly? |
Oh yeah that's an excellent topic! Incidentally yesterday I was looking at the mlr dev docs and they mentioned checkmate. Interested in contributing this post @Bisaloo et al? |
Looks like
Anyone have an idea of where they are in their release timeline so the post does not go out of date too quick? 😅
|
Speaking of rlang, this might be relevant as well: r-lib/rlang#1111 |
FYI a new rlang release is in the works AFAIK. |
For reference: https://twitter.com/krlmlr/status/1449470169303195651?s=21 |
This follows a discussion on our institute's slack workspace with @pearsonca, @seabbs, @TimTaylor.
What are the best practices for input checking in functions? This is an important question since R doesn't have an explicit type system (for now?).
stop()
/stopifnot()
.stopifnot()
can also take named argument to produce nicer error messages. It's also possible to write your own function if you end up testing the same kind of things many times.vctrs::vec_assert()
which also works withdata.frame
scheck's README also mentions other alternatives that didn't come up in the discussion:
The popularity of each of these packages (as measured by the number of GitHub stars) makes a good case that such a blog post would be appreciated by the community 😄
The text was updated successfully, but these errors were encountered: