checkmate
checkmate copied to clipboard
Feature request: `assert_all` and `assert_any` shortcuts
I find myself doing this a lot:
assert_all <- function(..., .var.name = NULL) checkmate::assert(..., combine = "and")
assert_any <- function(..., .var.name = NULL) checkmate::assert(..., combine = "or")
Would it be useful to add these shortcuts to {checkmate}?
Without it, I think newcomers to {checkmate} may often try to use assert()
without the correct logical reduction; obviously buyer-beware and folks should always read documentation, but the shortcuts above seem like nice {checkmate}
analogues to base::all()
and base::any()
.
I think this would be quite handy as well
As another upvote, I was wanting this earlier today and ended up doing something similar to what @mmuurr suggested.