The convenience function usually provide some defaults like description that can be overwritten by the user through the ... argument of the convenience function. This function manages to set those values that were NOT overwritten by the user through the ... argument and then call add_sanity_check.

h_add_sanity_check(
  ellipsis,
  fail_vec,
  .generated_desc,
  data,
  data_name = "",
  param_name = "",
  call = h_deparsed_sys_call(which = -2),
  .fail_vec_str = checkmate::vname(x = fail_vec)
)

Arguments

ellipsis

usually list(...) of the function that calls this function. It contains the parameters defined by the user for add_sanity_check.

fail_vec

logical vector where TRUE indicates that a fail has happend

.generated_desc

will be passed to .add_sanity_check if ellipsis does not contain a element with name 'description'

data

will be passed to .add_sanity_check if ellipsis does not contain a element with name 'data'

data_name

will be passed to .add_sanity_check if ellipsis does not contain a element with name 'data_name'

param_name

will be passed to .add_sanity_check if ellipsis does not contain a element with name 'param_name'

call

will be passed to .add_sanity_check if ellipsis does not contain a element with name 'call'

.fail_vec_str

usually not used by the user. Captures what was passed to fail_vec.

Value

see return value of add_sanity_check

Examples

d <- data.frame(type = letters[1:4], nmb = 1:4) # h_add_sanity_check is used on sc_col_elements() sc_col_elements(object = d, col = "type", feasible_elements = letters[2:4]) get_sanity_checks()
#> description additional_desc data_name #> 1: bmi above 15 - x #> 2: bmi below 30 - #> 3: bmi above 15 - #> 4: - Elements in 'type' should contain only 'b', 'c', 'd'. d #> n n_fail n_na counter_meas fail_vec_str #> 1: 4 1 0 none x$bmi < 15 #> 2: 4 1 0 none x$bmi > 30 #> 3: 4 1 0 - d$bmi < 15 #> 4: 4 1 0 - !(object[[col]] %in% feasible_elements) #> param_name call example #> 1: bmi dummy_call(x = d) <data.frame[1x3]> #> 2: - dummy_call(x = d) #> 3: - eval(expr, envir, enclos) #> 4: type eval(expr, envir, enclos) <data.frame[1x2]>