View source: R/validation-helpers.R
validateIsOfType | R Documentation |
Check if the provided object is of certain type. If not, stop with an error.
validateIsOfType(object, type, nullAllowed = FALSE) validateIsCharacter(object, nullAllowed = FALSE) validateIsString(object, nullAllowed = FALSE) validateIsNumeric(object, nullAllowed = FALSE) validateIsInteger(object, nullAllowed = FALSE) validateIsLogical(object, nullAllowed = FALSE)
object |
An object or an atomic vector or a list of objects. |
type |
A single string or a vector of string representation or class of the type that should be checked for. |
nullAllowed |
Boolean flag if |
NULL
if the entered object is of expected type, otherwise produces
error. Also accepts NULL
as an input if nullAllowed
argument is set to
TRUE
.
A <- data.frame( col1 = c(1, 2, 3), col2 = c(4, 5, 6), col3 = c(7, 8, 9) ) validateIsOfType(A, "data.frame") validateIsInteger(5) validateIsNumeric(1.2) validateIsCharacter("x") validateIsLogical(TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.