validate_safeframe {safeframe} | R Documentation |
Checks the content of a safeframe object
Description
This function evaluates the validity of a safeframe
object by checking the
object class, its tags, and the types of variables. It combines
validation checks made by validate_types()
and validate_tags()
. See
'Details' section for more information on the checks performed.
Usage
validate_safeframe(x, ...)
Arguments
x |
a |
... |
< |
Details
The following checks are performed:
-
x
is asafeframe
object variables in
x
have a well-formedlabel
attributevariables correspond to the specified types
Value
If checks pass, a safeframe
object; otherwise issues an error.
See Also
-
validate_types()
to check if variables have the right types -
validate_tags()
to perform a series of checks on the tags
Examples
## create a valid safeframe
x <- cars |>
make_safeframe(
mph = "speed",
distance = "dist"
)
x
## validation
validate_safeframe(x,
mph = c("numeric", "factor"),
distance = "numeric"
)
## the below issues an error
## note: tryCatch is only used to avoid a genuine error in the example
tryCatch(validate_safeframe(x,
mph = c("numeric", "factor"),
distance = "factor"
), error = paste)
[Package safeframe version 1.0.0 Index]