| checkPercentage {checkmate} | R Documentation |
This checks x to be numeric and in the range [0,1].
checkPercentage(x, na.ok = FALSE) assertPercentage(x, na.ok = FALSE, .var.name) testPercentage(x, na.ok = FALSE)
x |
[any] |
na.ok |
[ |
.var.name |
[character(1)] |
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, all functions return TRUE.
If the check is not successful, assertPercentage throws an error message,
testPercentage returns FALSE and checkPercentage returns
a string with the error message.
Other scalars: assertCount,
checkCount, testCount;
assertFlag, checkFlag,
testFlag; assertInt,
checkInt, testInt;
assertNumber, checkNumber,
testNumber; assertScalarNA,
checkScalarNA, testScalarNA;
assertScalar, checkScalar,
testScalar; assertString,
checkString, testString
testPercentage(0.5) testPercentage(1)