.complete_ae_data {gtreg} | R Documentation |
Create a complete and expanded data frame for tabulating adverse events
Description
Returns a data frame that has an observation for each patient in the study,
with combinations for each ID, SOC, and AE. The returned data frame includes
new logical columns "..ae.."
and "..soc.."
indicating whether that
row should be included when tabulating the AE table. When multiple
AEs of the same type are observed, the AE with the largest by=
value
is the observation to be used in the tabulation.
Usage
.complete_ae_data(
data,
id,
ae,
soc = NULL,
by = NULL,
strata = NULL,
id_df = NULL,
by_values = NULL,
missing_text = "Unknown",
missing_location = "first"
)
Arguments
data |
Data frame |
id |
String variable name of the patient ID |
ae |
String variable name of the adverse event column |
soc |
Optional string variable name of the system organ class column |
by |
Optional string variable to split results by, e.g. report AEs by grade or attribution |
strata |
Optional string variable to stratify results by, e.g. report AEs summaries by treatment group |
id_df |
Optional data frame of complete id values and strata to achieve correct base n for the situation in which not all subjects experience adverse events |
by_values |
Optional vector of complete by values, listed in desired order, to achieve correct table structure for the situation in which an adverse event of a certain grade is not observed for a given soc |
missing_text |
String that will be shown for missing levels of |
missing_location |
location where the column summarizing values with
missing levels |
Value
a tibble
Examples
df_adverse_events %>%
.complete_ae_data(
id = "patient_id",
ae = "adverse_event",
soc = "system_organ_class",
by = "grade",
strata = "trt"
)