time_to_initiation: Computation of initiation times.

View source: R/matching_function.R

time_to_initiationR Documentation

Computation of initiation times.

Description

Computes the time between the start of a prescription episode and the first dispensing event for each medication class.

Usage

time_to_initiation(
  presc.data = NULL,
  disp.data = NULL,
  ID.colname = NA,
  medication.class.colnames = NA,
  presc.start.colname = NA,
  disp.date.colname = NA,
  date.format = "%d.%m.%Y",
  suppress.warnings = FALSE,
  return.data.table = FALSE,
  ...
)

Arguments

presc.data

A data.frame or data.table containing the prescription episodes. Must contain, at a minimum, the patient unique ID, one medication identifier, and the start date of the prescription episode, and might also contain additional columns to identify and group medications (the actual column names are defined in the medication.class.colnames parameter).

disp.data

A data.frame or data.table containing the dispensing events. Must contain, at a minimum, the patient unique ID, one medication identifier, the dispensing date, and might also contain additional columns to identify and group medications (the actual column names are defined in the medication.class.colnames parameter).

ID.colname

A string, the name of the column in presc.data and disp.data containing the unique patient ID, or NA if not defined.

medication.class.colnames

A Vector of strings, the name(s) of the column(s) in data containing the classes/types/groups of medication, or NA if not defined.

presc.start.colname

A string, the name of the column in presc.data containing the prescription date (in the format given in the date.format parameter), or NA if not defined.

disp.date.colname

A string, the name of the column in disp.data containing the dispensing date (in the format given in the date.format parameter), or NA if not defined.

date.format

A string giving the format of the dates used in the data and the other parameters; see the format parameters of the as.Date function for details (NB, this concerns only the dates given as strings and not as Date objects).

suppress.warnings

Logical, if TRUE don't show any warnings.

return.data.table

Logical, if TRUE return a data.table object, otherwise a data.frame.

...

other possible parameters

Details

The period between the start of a prescription episode and the first dose administration may impact health outcomes differently than omitting doses once on treatment or interrupting medication for longer periods of time. Primary non-adherence (not acquiring the first prescription) or delayed initiation may have a negative impact on health outcomes. The function time_to_initiation calculates the time between the start of a prescription episode and the first dispensing event, taking into account multiple variables to differentiate between treatments.

Value

A data.frame or data.table with the following columns:

  • ID.colname the unique patient ID, as given by the ID.colname parameter.

  • medication.class.colnames the column(s) with classes/types/groups of medication, as given by the medication.class.colnames parameter.

  • episode.start the date of the first prescription event.

  • first.disp the date of the first dispensing event.

  • time.to.initiation the difference in days between the first dispensing date and the first prescription date.

Examples

time_init <- time_to_initiation(presc.data = durcomp.prescribing,
                                disp.data = durcomp.dispensing,
                                ID.colname = "ID",
                                medication.class.colnames = c("ATC.CODE", "FORM", "UNIT"),
                                presc.start.colname = "DATE.PRESC",
                                disp.date.colname = "DATE.DISP",
                                date.format = "%Y-%m-%d",
                                suppress.warnings = FALSE,
                                return.data.table = TRUE);

AdhereR documentation built on July 5, 2022, 5:08 p.m.