presc_by_time: Prescription Time Trends

Description Usage Arguments Value Examples

View source: R/summaries.R

Description

Function generates a breakdown of the number of prescriptions, and if requested daily doses dispensed, from prescriptions matching a chosen drug identifier over time - either broken down by month, quarter, semester or year.

Usage

1
2
3
presc_by_time(df, drug = ".", flatten = FALSE, group = "Y",
  drug_id_col = "drug_id", patient_id_col = "patient_id",
  presc_date_col = "presc_date_x", dd_disp_col = NULL, date_format)

Arguments

df

a data frame containing prescribing records to be analysed - records must contain at least a drug identifier and 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

flatten

logical, if TRUE the function will only count one record/ prescription per patient per drug ID per date

group

a string corresponding to the desired grouping for results - either month ("M"), quarter ("Q"), semester ("S") or year ("Y")

drug_id_col

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

patient_id_col

a string, the name of the column in df containing the patient 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 data frame containing the selected time intervals and the corresponding number of prescriptions and patients with at least 1 prescription during the interval

Examples

1
2
3
presc_by_time(synth_presc, drug = "SIMVASTATIN",
drug_id_col = "approved_name", 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.