Skip to content

Commit

Permalink
refactor: use newly created get variables function
Browse files Browse the repository at this point in the history
  • Loading branch information
lwjohnst86 committed Mar 8, 2024
1 parent d08147e commit ec1e7aa
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions R/verify-variables.R
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,12 @@
#' verify_required_variables(example_bef_data, "bef")
verify_required_variables <- function(data, register) {
checkmate::assert_choice(register, get_register_abbrev())
expected_variables <- required_variables |>
dplyr::filter(.data$register_abbrev == register) |>
dplyr::pull(.data$variable_name)

expected_variables <- get_required_variables(register)

actual_variables <- names(data)

# TODO: Consider using/looking into rlang::try_fetch() to provide contextual error messages.
checkmate::check_names(
x = actual_variables,
must.include = expected_variables
Expand Down

0 comments on commit ec1e7aa

Please sign in to comment.