Description Usage Arguments Value Examples
View source: R/create_datasets.R
This takes an NHANES list object created with rxq_rx as a data input using the load_merge function, identify all drugs in a provided list of drugs with the relevant RXDDRGID in it, and add an indicator to the main data for each person who reported using that drug. All variables from the drug file are imported for each drug. There is no need for the NHANES list object after running this function.
1 | merge_drugs(nhanes_data, drug_code_list)
|
nhanes_data |
The NHANES list object returned from the load_merge function when rxq_rx data was requested |
drug_code_list |
A named list of drug codes (not vector). Each drug or drug class in the list must contain at least one RXDDRGID. |
Returns a data.table with one row per person with all of the main (cohort) data, plus the drugs added. The name used for the list will be appended to each column from the drug table to allow for distinction among drugs in the list.
1 2 3 4 5 | ## Not run:
# Identify drugs from list_of_drugs from nhanes_1999 dataset created using load_merge()
data_99 <- merge_drugs(nhanes_1999, list_of_drugs)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.