This function takes an extracted table from either extract_demographics() or extract_timevarying() and returns the same table having dealt with out of range values. Currently this will either modify the value to NA, or limit the value at an appropriate max or min, depending upon the user decision.

clean(tbl = NULL, dq_ref = NULL, action = "NA")

Arguments

tbl

a table extracted from the CC-HIC database

dq_ref

a table with ranges to override the default settings. Must take the following columns:

  • code_name: string vector with NIHR code name for the data item as it appears in your table.

  • ranges: the lower and upper bounds of a possible value represented as a string of the form "[lower, upper]"

action

string vector lengh 1 of "NA" or "limit". Currently this applies the action to all variables in the table.

Value

a table of the same dimensions as tbl but with outlying values appropriately cleaned.