heims (version 0.4.0)

decode_heims: Decode HEIMS elements

Description

Decode HEIMS elements

Usage

decode_heims(DT, show_progress = FALSE, check_valid = TRUE, selector)

Arguments

DT

A data.table with the original HEIMS column names.

show_progress

Display the progress of the function (which is likely to be slow on real data).

check_valid

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.

selector

Original HEIMS names to restrict the decoding to. Other names will be preserved.

Value

DT with the values decoded and the names renamed.

Details

Each variable in DT is validated according heims_data_dict before being decoded. Any failure stops the validation.

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.

Examples

Run this code
# 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