Skip to contents

Use this function inside another function within an if condition to provide an informative error message within the function used. This is done to make the error message more informative to the location that the error actually occurs, rather than within this function.

Usage

verify_required_variables(data, register, call = rlang::caller_env())

Arguments

data

The dataset to check.

register

The abbreviation of the register name. See list of abbreviations in get_register_abbrev().

call

The environment where the function is called, so that the error traceback gives a more meaningful location.

Value

Either TRUE if the verification passes, or an error.

Examples

if (FALSE) { # \dontrun{
# TODO: Replace with simulated data.
verify_required_variables(register_data$bef, "bef")
verify_required_variables(register_data$lpr_adm, "lpr_adm")
} # }