You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[character(1)] Check for names. See checkNamed for possible values. Default is “any” which performs no check at all. Note that you can use checkSubset to check for a specific set of names.
So am I supposed to use checkSubset() inside checkCharacter()? How?
You seem to misunderstand what the manual says: the possible values for the names argument of checkCharacter are listed in ?checkNamed (see the type argument). So you can have sthing like:
checkCharacter(c(a = "A", b = "B"), names = "unique") # this passes
#checkCharacter(c(a = "A", b = "B"), names = "unnamed") # this fails
If you want to check for a specific set of names, you have to use checkSubset:
x <- c(a = "A", b = "B")
assert(
checkCharacter(x),
checkSubset(names(x), choices = base::letters),
combine = "and"
)
Activity
tdeenes commentedon Nov 13, 2023
You seem to misunderstand what the manual says: the possible values for the
namesargument ofcheckCharacterare listed in?checkNamed(see thetypeargument). So you can have sthing like:If you want to check for a specific set of names, you have to use
checkSubset:vertesy commentedon Nov 13, 2023
Ah, thanks, especially for typing out the examples!!
clear now!