Skip to contents

This function adds additional fields required by this package including variable type (TYPE), minimum value (MIN), and maximum value (MAX).





Data dictionary.

Data set.


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
DD.dict.updated <- add_missing_fields(DD.dict.D,
#> $Message
#> [1] "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
#> [1] "TYPE" "MIN"  "MAX"