View source: R/validate_safeframe.R
validate_safeframe | R Documentation |
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.
validate_safeframe(x, ...)
x |
a |
... |
< |
The following checks are performed:
x
is a safeframe
object
variables in x
have a well-formed label
attribute
variables correspond to the specified types
If checks pass, a safeframe
object; otherwise issues an error.
validate_types()
to check if variables have the right types
validate_tags()
to perform a series of checks on the tags
## 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.