assert | R Documentation |
Ensures that a variable respects several parameters
assert(x, len = NULL, cla = NULL, typ = NULL, alw = NULL, fun = "stop")
x |
variable to test |
len |
integer vector of allowed length for x. Default is NULL, for not checking this parameter. |
cla |
character vector of allowed classes of x. Default is NULL, for not checking this parameter. |
typ |
character vector of allowed types of x. Default is NULL, for not checking this parameter. |
alw |
allowed values for x. Default is NULL, for not checking this parameter. |
fun |
function to execute when mandatory parameters are not met. Default is "stop". Allowed are "stop","warning","message","return". |
/!\ alw parameter when used should be coercible to a logical, integer, numeric, complex or character vector. Otherwise, an error will be thrown.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.