Check if an argument is named
Check if an argument is named
checkNamed(x, type = "named") check_named(x, type = "named") assertNamed(x, type = "named", .var.name = vname(x), add = NULL) assert_named(x, type = "named", .var.name = vname(x), add = NULL) testNamed(x, type = "named") test_named(x, type = "named")
x |
[any] |
type |
[character(1)] |
.var.name |
[ |
add |
[ |
Depending on the function prefix:
If the check is successful, the functions
assertNamed
/assert_named
return
x
invisibly, whereas
checkNamed
/check_named
and
testNamed
/test_named
return
TRUE
.
If the check is not successful,
assertNamed
/assert_named
throws an error message,
testNamed
/test_named
returns FALSE
,
and checkNamed
returns a string with the error message.
The function expect_named
always returns an
expectation
.
These function are deprecated and will be removed in a future version.
Please use checkNames
instead.
Other attributes:
checkClass()
,
checkMultiClass()
,
checkNames()
x = 1:3 testNamed(x, "unnamed") names(x) = letters[1:3] testNamed(x, "unique")
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.