Open ndunnewind opened 8 months ago
It's also an issue when x
is a vector and multiple
is set to TRUE
:
sorting_hat <- function(house = c("Gryffindor", "Slytherin", "Ravenclaw", "Hufflepuff"), multiple = FALSE) {
rlang::arg_match(house, multiple = multiple)
}
sorting_hat(c("Gryffindor", "Slytherin"), multiple = TRUE)
#> [1] "Gryffindor" "Slytherin"
sorting_hat(c("Gryffindor", "Slytherin"), multiple = FALSE)
#> Error in `sorting_hat()`:
#> ! `house` must be one of "Gryffindor", "Slytherin", "Ravenclaw", or
#> "Hufflepuff", not "Gryffindor".
Created on 2024-04-05 with reprex v2.1.0
This is unrelated.
If
arg
inarg_match()
is a character vector with more than one element (and is not a permuted version ofvalues
) the error message only mentions the first element. This is confusing if the first element is actually invalues
, as shown below.Created on 2024-01-22 with reprex v2.1.0