Learn R Programming

checkmate (version 1.0)

checkScalarNA: Check if an argument is a single missing value

Description

Check if an argument is a single missing value

Usage

checkScalarNA(x)

assertScalarNA(x, .var.name)

testScalarNA(x)

Arguments

x
[ANY] Object to check.
.var.name
[character(1)] Name for x. Defaults to a heuristic to determine the name using deparse and substitute.

Value

  • Depending on the function prefix: If the check is successful, all functions return TRUE. If the check is not successful, assertScalarNA throws an error message, testScalarNA returns FALSE and checkScalarNA returns a string with the error message.

See Also

Other scalars: assertCount, checkCount, testCount; assertFlag, checkFlag, testFlag; assertInt, checkInt, testInt; assertNumber, checkNumber, testNumber; assertScalar, checkScalar, testScalar; assertString, checkString, testString

Examples

Run this code
testScalarNA(1)
 testScalarNA(NA_real_)
 testScalarNA(rep(NA, 2))

Run the code above in your browser using DataLab