count_cases: Convert data on the report level to aggregated data.

Description Usage Arguments Value Examples

View source: R/count_cases.R

Description

The count_cases function is used to convert data on the report level to aggregated data, grouping by specified covariates.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
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 breaks[i], find the interval containing each element of covar_cont[i]; i.e., for each index j in breaks[i], value j is assigned to covar_cont[i] if and only if breaks[i][j] <= covar_cont[i] < breaks[i][j+1].

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:

Examples

1
2
3
4
# 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)))
            

AEenrich documentation built on Nov. 1, 2021, 5:07 p.m.