Learn R Programming

AdhereR (version 0.4)

time_to_initiation: Computation of initiation times.

Description

Computes the time between the first prescription event and the first dispensing event for each medication class.

Usage

time_to_initiation(presc.data = NULL, disp.data = NULL,
  ID.colname = NA, presc.start.colname = NA, disp.date.colname = NA,
  medication.class.colnames = 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 events. Must contain, at a minimum, the patient unique ID, one medication identifier, and the start date of the prescription, 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.

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.

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.

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

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.

  • first.presc 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.

Details

The period between the first prescription event 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 first prescription and the first dispensing event, taking into account multiple variables to differentiate between treatments.

Examples

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

Run the code above in your browser using DataLab