This function creates a logical data frame where each column represents a specific sub-combination of drugs derived from a given "cocktail." For each patient in the input data, it indicates (TRUE/FALSE) whether they were taking that specific combination based on the ATC hierarchy.
combination_data_frame(cocktail, upperBound, data)A Rcpp::DataFrame where:
Each column corresponds to a sub-combination of the input cocktail.
Each row corresponds to a patient in the input data.
Values are boolean indicators (represented as integers/logicals in R).
An integer vector of drug indices representing the full combination to be analyzed.
An integer vector defining the ATC tree hierarchy bounds.
A Rcpp::DataFrame containing patient records. It must
include a column "patientATC" which is a list of integer vectors
representing the drugs each patient is taking.
The function first generates all possible non-empty power-set combinations of the
cocktail (e.g., for \(\{1, 2\}\), it generates \(\{1\}, \{2\}, \{1, 2\}\)).