add_expected_counts {pvda}R Documentation

Produces expected counts

Description

Produces various counts used in disproportionality analysis.

Usage

add_expected_counts(
  df = NULL,
  df_colnames = NULL,
  df_syms = NULL,
  expected_count_estimators = c("rrr", "prr", "ror")
)

Arguments

df

An object possible to convert to a data table, e.g. a tibble or data.frame, containing patient level reported drug-event-pairs. See header 'The df object' below for further details.

df_colnames

A list of column names to use in df. That is, point da to the 'report id'-column (report_id), the 'drug name'-column (drug), the 'adverse event'-column (event) and optionally a grouping column group_by to calculate disproportionality across. See the vignette for further details.

df_syms

A list built from df_colnames through conversion to symbols.

expected_count_estimators

A character vector containing the desired expected count estimators. Defaults to c("rrr", "prr", "ror").

Value

A tibble containing the various counts.

The df object

The passed df should be (convertible to) a data table and at least contain three columns: report_id, drug and event. The data table should contain one row per reported drug-event-combination, i.e. receiving a single additional report for drug X and event Y would add one row to the table. If the single report contained drug X for event Y and event Z, two rows would be added, with the same report_id and drug on both rows. Column report_id must be of type numeric or character. Columns drug and event must be of type character. If column group_by is provided, it can be either numeric or character. You can use a df with column names of your choosing, as long as you connect role and name in the df_colnames-parameter.


[Package pvda version 0.0.3 Index]