View source: R/checkCharacter.R
checkCharacter | R Documentation |
To check for scalar strings, see checkString
.
checkCharacter(
x,
n.chars = NULL,
min.chars = NULL,
max.chars = NULL,
pattern = NULL,
fixed = NULL,
ignore.case = FALSE,
any.missing = TRUE,
all.missing = TRUE,
len = NULL,
min.len = NULL,
max.len = NULL,
unique = FALSE,
sorted = FALSE,
names = NULL,
typed.missing = FALSE,
null.ok = FALSE
)
check_character(
x,
n.chars = NULL,
min.chars = NULL,
max.chars = NULL,
pattern = NULL,
fixed = NULL,
ignore.case = FALSE,
any.missing = TRUE,
all.missing = TRUE,
len = NULL,
min.len = NULL,
max.len = NULL,
unique = FALSE,
sorted = FALSE,
names = NULL,
typed.missing = FALSE,
null.ok = FALSE
)
assertCharacter(
x,
n.chars = NULL,
min.chars = NULL,
max.chars = NULL,
pattern = NULL,
fixed = NULL,
ignore.case = FALSE,
any.missing = TRUE,
all.missing = TRUE,
len = NULL,
min.len = NULL,
max.len = NULL,
unique = FALSE,
sorted = FALSE,
names = NULL,
typed.missing = FALSE,
null.ok = FALSE,
.var.name = vname(x),
add = NULL
)
assert_character(
x,
n.chars = NULL,
min.chars = NULL,
max.chars = NULL,
pattern = NULL,
fixed = NULL,
ignore.case = FALSE,
any.missing = TRUE,
all.missing = TRUE,
len = NULL,
min.len = NULL,
max.len = NULL,
unique = FALSE,
sorted = FALSE,
names = NULL,
typed.missing = FALSE,
null.ok = FALSE,
.var.name = vname(x),
add = NULL
)
testCharacter(
x,
n.chars = NULL,
min.chars = NULL,
max.chars = NULL,
pattern = NULL,
fixed = NULL,
ignore.case = FALSE,
any.missing = TRUE,
all.missing = TRUE,
len = NULL,
min.len = NULL,
max.len = NULL,
unique = FALSE,
sorted = FALSE,
names = NULL,
typed.missing = FALSE,
null.ok = FALSE
)
test_character(
x,
n.chars = NULL,
min.chars = NULL,
max.chars = NULL,
pattern = NULL,
fixed = NULL,
ignore.case = FALSE,
any.missing = TRUE,
all.missing = TRUE,
len = NULL,
min.len = NULL,
max.len = NULL,
unique = FALSE,
sorted = FALSE,
names = NULL,
typed.missing = FALSE,
null.ok = FALSE
)
expect_character(
x,
n.chars = NULL,
min.chars = NULL,
max.chars = NULL,
pattern = NULL,
fixed = NULL,
ignore.case = FALSE,
any.missing = TRUE,
all.missing = TRUE,
len = NULL,
min.len = NULL,
max.len = NULL,
unique = FALSE,
sorted = FALSE,
names = NULL,
typed.missing = FALSE,
null.ok = FALSE,
info = NULL,
label = vname(x)
)
x |
[any] |
n.chars |
[ |
min.chars |
[ |
max.chars |
[ |
pattern |
[ |
fixed |
[ |
ignore.case |
[ |
any.missing |
[ |
all.missing |
[ |
len |
[ |
min.len |
[ |
max.len |
[ |
unique |
[ |
sorted |
[ |
names |
[ |
typed.missing |
[ |
null.ok |
[ |
.var.name |
[ |
add |
[ |
info |
[ |
label |
[ |
This function does not distinguish between
NA
, NA_integer_
, NA_real_
, NA_complex_
NA_character_
and NaN
.
Depending on the function prefix:
If the check is successful, the functions
assertCharacter
/assert_character
return
x
invisibly, whereas
checkCharacter
/check_character
and
testCharacter
/test_character
return
TRUE
.
If the check is not successful,
assertCharacter
/assert_character
throws an error message,
testCharacter
/test_character
returns FALSE
,
and checkCharacter
/check_character
return a string with the error message.
The function expect_character
always returns an
expectation
.
Other basetypes:
checkArray()
,
checkAtomic()
,
checkAtomicVector()
,
checkComplex()
,
checkDataFrame()
,
checkDate()
,
checkDouble()
,
checkEnvironment()
,
checkFactor()
,
checkFormula()
,
checkFunction()
,
checkInteger()
,
checkIntegerish()
,
checkList()
,
checkLogical()
,
checkMatrix()
,
checkNull()
,
checkNumeric()
,
checkPOSIXct()
,
checkRaw()
,
checkVector()
testCharacter(letters, min.len = 1, any.missing = FALSE)
testCharacter(letters, min.chars = 2)
testCharacter("example", pattern = "xa")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.