pharmaverse / admiral

ADaM in R Asset Library
https://pharmaverse.github.io/admiral
Apache License 2.0
220 stars 62 forks source link

General Issue: Make subject keys flexible in all functions #2501

Open bms63 opened 1 week ago

bms63 commented 1 week ago

Background Information

Background Information

@bundfussr did a review of the admiral functions and found 2 occurrences where STUDYID and USUBJID are hardcoded instead of using get_admiral_option("subject_keys") as per https://pharmaverse.github.io/admiral/reference/#admiral-options.

These are derive_vars_atc() and create_single_dose_dataset(), for example:

derive_vars_atc <- function(dataset,
                            dataset_facm,
                            by_vars = exprs(USUBJID, CMREFID = FAREFID),
                            value_var = FASTRESC)

Definition of Done

These functions should be flexible so as if ever set_admiral_options(subject_keys = exprs(STUDYID, USUBJID2)) was set by user then these variables would be used everywhere instead of USUBJID.