Decode HEIMS elements
decode_heims(DT, show_progress = FALSE, check_valid = TRUE, selector)
A data.table with the original HEIMS column names.
data.table
Display the progress of the function (which is likely to be slow on real data).
Check the variable is valid before decoding. Setting to FALSE is faster, but should only be done when you know the data has been validated.
FALSE
Original HEIMS names to restrict the decoding to. Other names will be preserved.
DT with the values decoded and the names renamed.
DT
Each variable in DT is validated according heims_data_dict before being decoded. Any failure stops the validation.
heims_data_dict
If DT has a key, the output will have a key, but set on the decoded columns and the ordering will most likely change (to reflect the decoded values).
This function will, on the full HEIMS data, take a long time to finish. Typically in the order of 10 minutes for the enrol file.
# NOT RUN { # (E488 is made up so won't work if validation is attempted.) decode_heims(dummy_enrol) # } # NOT RUN { decode_heims(dummy_enrol, show_progress = TRUE, check_valid = FALSE) # }
Run the code above in your browser using DataCamp Workspace