Description Usage Arguments Value Examples
Utility functions for checking the type of an argument, based on TypeChecker in the same package. If the argument is not of the expected type, an error will be thrown. Usually, these utility functions are called at the begining of a function body.
1 | Precondition(allowNA = FALSE, allowNull = FALSE)
|
allowNA |
Should NA be allowed? The method checkIsNull ignores this parameter. |
allowNull |
Should NULL be allowed? The method checkIsNA ignores this parameter. |
an instance of Precondition
1 2 3 4 5 | precondition <- Precondition()
myFunction <- function(x) {
precondition$isNumeric(x, 'x should be numeric')
...
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.