validate_types {safeframe} | R Documentation |
Type check variables
Description
This function checks the type of variables in a safeframe
against
accepted classes. Only checks the type of provided variables and ignores
those not provided.
Usage
validate_types(x, ...)
Arguments
x |
a |
... |
< |
Value
A named list
.
See Also
-
validate_tags()
to perform a series of checks on variables -
validate_safeframe()
to combinevalidate_tags
andvalidate_types
Examples
x <- make_safeframe(cars,
mph = "speed",
distance = "dist"
)
x
## the below would issue an error
## note: tryCatch is only used to avoid a genuine error in the example
tryCatch(validate_types(x), error = paste)
## to allow other types, e.g. gender to be integer, character or factor
validate_types(x, mph = "numeric", distance = c(
"integer",
"character", "numeric"
))
[Package safeframe version 1.0.0 Index]