Description Usage Arguments Value Examples
Enforce parameter types (logical, character, etc.).
1 2 | enforce_type(object, admissible_types, function_name,
name = deparse(substitute(object)))
|
object |
ANY. An R object to enforce types on. |
admissible_types |
character. A character vector of allowed types. |
function_name |
character. The function this enforcement is occurring in, for error messages. |
name |
character. The name of the parameter whose type is being
enforced. By default, the string expression passed in to the first
argument, |
Nothing, but error if the type does not match.
1 2 3 4 5 6 7 8 | ## Not run:
x <- 1
enforce_type(x, "logical", "myfunction")
# Will call stop() with the following error:
# "In 'myfunction', the 'x' parameter must be a character; instead, I got
# a logical.
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.