mllg / checkmate

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

qassertm: qassert for many at once #229

Open WillForan opened 2 years ago

WillForan commented 2 years ago

I was looking for a way to condense

function(x,y,z){
  qassert(x='n')
  qassert(y='b')
  qassert(z='s')
}

and came up with

funtion(x,y,z) { qassertm(x='n', y='b', z='s') }

I also like it for checking specific columns of a datafame:

with(data.frame(x=1:10,y=T), qassertm(x='i', y='b'))

I'm not sure if this is generally helpful (#228) or if I missed a more idiomatic way to run multiple checks. Happy to see the request "ruthlessly closed" if fails on either front!