assertthat
assertthat copied to clipboard
support %in%
it would be nice if there were a built-in assertion to test whether some object is %in% another one (say, a list or vector etc). This might be common when there are several available options, to test whether the passed argument is permissible.
Currently, say assert_that(factor %in% colnames(results$loa))
is possible, but on error, gives the slightly uninformative
#$ Error: `%in%`(x = factor, table = colnames(results$loa)) is not TRUE
Yes, the same applies for the is.element function.