checkmate icon indicating copy to clipboard operation
checkmate copied to clipboard

Feature request: `assert_all` and `assert_any` shortcuts

Open mmuurr opened this issue 2 years ago • 2 comments

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

mmuurr avatar Mar 21 '22 01:03 mmuurr

I think this would be quite handy as well

sebffischer avatar Apr 25 '22 18:04 sebffischer

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

billdenney avatar Sep 29 '23 01:09 billdenney