Description Usage Arguments Details Value Examples
View source: R/isNaOrNanVector.R
This function can be used in 3 ways:
Return TRUE or FALSE depending on whether the argument checks are
passed. This is suitable e.g. for if statements that take further action
if the argument does not pass the checks.
Throw an exception if the argument does not pass the checks. This is
suitable e.g. when no further action needs to be taken other than
throwing an exception if the argument does not pass the checks.
Same as (2) but by supplying a default value, a default can be assigned
in a single statement, when the argument is NULL. The checks are still
performed on the returned value, and an exception is thrown when not
passed.
1 2 |
argument |
See checkarg function. |
default |
See checkarg function. |
stopIfNot |
See checkarg function. |
n |
See checkarg function. |
message |
See checkarg function. |
argumentName |
See checkarg function. |
Actual call to checkarg: checkarg(argument, "N", default = default, stopIfNot = stopIfNot, nullAllowed = FALSE, n = NA, zeroAllowed = FALSE, negativeAllowed = FALSE, positiveAllowed = FALSE, nonIntegerAllowed = TRUE, naAllowed = TRUE, nanAllowed = TRUE, infAllowed = FALSE, message = message, argumentName = argumentName)
See checkarg function.
1 2 3 4 5 6 7 8 9 10 11 12 | isNaOrNanVector(NA)
# returns TRUE (argument is valid)
isNaOrNanVector("X")
# returns FALSE (argument is invalid)
#isNaOrNanVector("X", stopIfNot = TRUE)
# throws exception with message defined by message and argumentName parameters
isNaOrNanVector(NA, default = NaN)
# returns NA (the argument, rather than the default, since it is not NULL)
#isNaOrNanVector("X", default = NaN)
# throws exception with message defined by message and argumentName parameters
isNaOrNanVector(NULL, default = NaN)
# returns NaN (the default, rather than the argument, since it is NULL)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.