Add Missing FieldsSource:
This function adds additional fields required by this package including variable type (
TYPE), minimum value (
MIN), and maximum value (
A data frame containing the updated data dictionary with missing fields added in, or NULL if any required pre-checks fail.
Even though MIN, MAX, and TYPE are not required by dbGaP, our package was created to use these variables in a series of other checks and awareness functions (e.g., render_report, values_check, etc.). MIN/MAX columns will be added as empty columns as dbGaP instructions state that the MIN and MAX should be the "logical" MIN/MAX for the data, not necessarily the observed MIN/MAX, which would be study and variable specific. TYPE will be inferred from the data set and data dictionary VALUES columns. Note however, that if the VALUES columns are not set up correctly, then this function can't properly infer the data TYPE from the data set and data dictionary.
# Example data(ExampleD) DD.dict.updated <- add_missing_fields(DD.dict.D, DS.data.D) #> $Message #>  "CORRECTED ERROR: not all package-level required fields were present in the data dictionary. The missing fields have now been added! TYPE was inferred from the data, and MIN/MAX have been added as empty fields." #> #> $Missing #>  "TYPE" "MIN" "MAX" #>