mllg / checkmate

Fast and versatile argument checks
https://mllg.github.io/checkmate/
Other
261 stars 30 forks source link

Feature request: `assert_all` and `assert_any` shortcuts #222

Open mmuurr opened 2 years ago

mmuurr commented 2 years ago

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().

sebffischer commented 2 years ago

I think this would be quite handy as well

billdenney commented 11 months ago

As another upvote, I was wanting this earlier today and ended up doing something similar to what @mmuurr suggested.