count_cases {AEenrich} | R Documentation |
Convert data on the report level to aggregated data.
Description
The count_cases function is used to convert data on the report level to aggregated data, grouping by specified covariates.
Usage
count_cases(
data,
drug.case = drug.case,
drug.control = NULL,
covar_disc = NULL,
covar_cont = NULL,
breaks = NULL,
cores = detectCores(),
min_AE = 10
)
Arguments
data |
a data.frame with at least 3 columns, consisting data on the report level, having ID, Drug type and AE name as the first 3 columns with covariates(optional) followed. The order of columns is not interchangeable. |
drug.case |
a character string for the target drug of interest. |
drug.control |
a character string for the reference drug. If NULL(default), all other drugs combined are the reference. |
covar_disc |
a character vector of categorical covariates. |
covar_cont |
a character vector of continuous covariates. |
breaks |
a list consists of vectors used for creating specific bins to
transform continuous covariates into categorical. Breaks Should have the same
length as covar_cont. Given a vector of non-decreasing breakpoints in |
cores |
the number of cores to use for parallel execution. |
min_AE |
the minimum number of cases required to start counting for a specific AE. Default 10. |
Value
A data.frame consists of aggregated data.
The returned data.frame contains the following columns:
DRUG_TYPE: type of the drug, DrugYes for target drug and DrugNo for referenced drug
AE_NAME: the name of the adverse event
AEyes: number of observations that have this AE
AEno: number of observations that do not have this AE
covariates: covariates specifed by user
Examples
# count_cases(data = covid1, drug.case = "COVID19", drug.control = "OTHER",
# covar_cont = c("AGE"), covar_disc = c("SEX"),
# breaks = list(c(16,30,50,65,120)))