dd_duration: Calculate Prescription Durations

Description Usage Arguments Value Examples

View source: R/daily_dose.R

Description

Calculates the duration in days of individual prescriptions based on the number of daily doses dispensed. A multiplication factor is applied to allow for use in cases where, for example an assumption of less or more than 1 DDD per day is required

Usage

1
2
3
dd_duration(df, drug, dd_factor = 1, patient_id_col = "patient_id",
  drug_id_col = "drug_id", presc_date_col = "presc_date_x",
  dd_disp_col = "dd_disp", date_format)

Arguments

df

a data frame containing prescribing records to be analysed - records must contain at least a paitent ID, drug ID, a prescription date

drug

a string containing a drug ID to be used to limit the prescribing data to the drug(s) of interest, accepts regular expressions

dd_factor

a number, a multiplication factor applied to the dd_disp field to calculate prescription duration

patient_id_col

a string, the name of the column in df containing the patient IDs

drug_id_col

a string, the name of the column in df containing the drug IDs

presc_date_col

a string, the name of the column in df containing the prescption date

dd_disp_col

a string, the name of the column in df containing the number of daily doses dispensed

date_format

a string, the format of the dates in df

Value

a modified version of df with records for the drug of interest with the duration field added

Examples

1
2
3
dd_duration(synth_presc, drug = "212000",
drug_id_col = "bnf_paragraph", presc_date_col = "presc_date",
dd_disp_col = "ddd_dispensed", date_format = "%Y-%m-%d")

amarshall1/prescribeR documentation built on May 20, 2020, 2:34 p.m.