check_data_names | R Documentation |
Use this function to check names of input data sets against parameters that
have been assigned different tags. Assignment is made in the model
specification file. This is useful to alert the user to misspelled or
otherwise misspecified parameter names in input data sets. See param_tags()
for information on associating tags with parameters.
check_data_names(
data,
x,
check_covariates = TRUE,
check_inputs = TRUE,
tags = NULL,
mode = c("warn", "error", "inform"),
silent = FALSE
)
data |
a data frame or other object with names to check. |
x |
a model object. |
check_covariates |
logical; if |
check_inputs |
logical; if |
tags |
a character vector of user-defined parameter tags to require
in |
mode |
the default is to |
silent |
silences message on successful check. |
By default, data
will be checked for parameters with the covariates
or
input
tags; these checks can be bypassed with the check_covariates
and check_inputs
arguments. When a parameter name is missing from data
the user will be warned by default. Use mode = "error"
to generate an
error instead of a warning and use mode = "inform"
to simply be informed.
When the user has not tagged any parameters for checking, there will
either be a warning (default) or an error (when mode = "error"
).
It is an error to request a parameter tag via the tags
argument when that
tag is not found in the model.
It is an error to call check_data_names
when no parameters have been tagged
in the model specification file (see param_tags()
).
A logical value is returned; TRUE
if all expected parameters were found
and FALSE
otherwise.
param_tags()
mod <- mcode("ex-cdn", "$PARAM @input \n CL = 1, KA = 2", compile = FALSE)
param(mod)
# Coding mistake!
data <- expand.evd(amt = 100, cl = 2, KA = 5)
check_data_names(data, mod)
try(check_data_names(data, mod, mode = "error"))
check_data_names(data, mod, mode = "inform")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.