Closed nutterb closed 8 years ago
I submitted this function to the checkmate
repository. It may or not be accepted there. I should include it in pixiedust
for now. It at least gives me something to work with until something comes along that supports the AssertCollection
object.
assert_match_arg <- function(x, choices, several_ok = FALSE, ...)
{
x <- choices[pmatch(x, choices, nomatch = 0L, duplicates.ok = several_ok)]
if (several_ok) assertSubset(x, choices, ...)
else assertChoice(x, choices, ...)
x
}
Implemented in 0.6.4
From having switched to checkmate
halign
does partial matching and will fail if multiple values are specified. Having usedassertSubset
, I don't get that same behavior quite so easily.For bookdown support