uat_gap: Two Prescriptions Within a Desired Timeframe

Description Usage Arguments Value Examples

View source: R/use_at_time.R

Description

Classifies patients as exposed or unexposed based on whether they received two prescriptions for the drug of interest within a desired number of days of each other

Usage

1
2
3
uat_gap(df, drug, timeframe, return_all = FALSE,
  patient_id_col = "patient_id", drug_id_col = "drug_id",
  presc_date_col = "presc_date_x", date_format)

Arguments

df

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

timeframe

a number representing the desired maximum gap between prescriptions

return_all

logical, if TRUE function returns data for all patient IDs with a flag indicating which patients did and did not meet the threshold for exposure

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

date_format

a string, the format of the dates in df

Value

a data frame containing the patient IDs and first two prescription dates for patients who meet the definition of exposure

Examples

1
2
3
uat_gap(df = synth_presc, drug = "SIMVASTATIN", timeframe = 14,
patient_id_col = "patient_id", drug_id_col = "approved_name",
presc_date_col = "presc_date", date_format = "%Y-%m-%d")

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