Description Usage Arguments Details See Also
View source: R/util_correct_variable_use.R
This function operates in the environment of its caller
(using eval.parent, similar to Function like C-Preprocessor-Macros
).
Different from the other utility function that work
in the caller's environment (util_prepare_dataframes), It has no side
effects except that the argument
of the calling function specified in arg_name
is normalized (set to its
default or a general default if missing, variable names being all white
space replaced by NAs).
It expects two objects in the caller's environment: ds1
and meta_data
.
meta_data
is the meta data frame and ds1
is produced by a preceding call
of util_prepare_dataframes using meta_data
and study_data
.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | util_correct_variable_use(
arg_name,
allow_na,
allow_more_than_one,
allow_null,
allow_all_obs_na,
allow_any_obs_na,
need_type,
role = ""
)
util_correct_variable_use2(
arg_name,
allow_na,
allow_more_than_one,
allow_null,
allow_all_obs_na,
allow_any_obs_na,
need_type,
role = arg_name
)
|
arg_name |
character Name of a function argument of the caller of util_correct_variable_use |
allow_na |
logical default = FALSE. allow NAs in the variable names
argument given in |
allow_more_than_one |
logical default = FALSE. allow more than one
variable names in |
allow_null |
logical default = FALSE. allow an empty variable name
vector in the argument |
allow_all_obs_na |
logical default = TRUE. check observations for not
being all |
allow_any_obs_na |
logical default = TRUE. check observations for
being complete without any |
need_type |
character if not |
role |
character variable-argument role. Set different defaults for
all |
util_correct_variable_use and util_correct_variable_use2 differ only in
the default of the argument role
.
util_correct_variable_use and util_correct_variable_use2 put strong
effort on producing compressible
error messages to the caller's caller (who is typically an end user of
a dataquieR
function).
The function ensures, that a specified argument of its caller that refers variable names (one or more as character vector) matches some expectations.
This function accesses the caller's environment!
.variable_arg_roles
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.