uat_recent: Define Recentness of Exposure at Event Date

Description Usage Arguments Value Examples

View source: R/use_at_time.R

Description

Classifies patients as current or past users of the drug(s) of interest at an event date based on a user-defined time window, and calculates the number of prescriptions that fall within and outwith the recent use window.

Usage

1
2
3
uat_recent(df, df2, drug, timeframe, patient_id_col = "patient_id",
  drug_id_col = "drug_id", presc_date_col = "presc_date_x",
  ev_date_col = "ev_date_1", date_format)

Arguments

df

a data frame containing prescription records to be analysed; records must contain at least a patient ID, drug ID and prescription date

df2

a data frame containing medical event data to be analysed; records must contain at least a patient ID and event date, maximum 1 event per patient

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, subtracted from the event date to define the start of the rexcent use period

patient_id_col

a string, the name of the column in df and df2 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 date the drug was prescribed

ev_date_col

a string, the name of the column in df2 containing the event dates

date_format

a string, the format of the dates contained in df and df2

Value

a data frame containing patient IDs, the number of prescriptions in each period and the use classification at the event date

Examples

1
2
3
uat_recent(df = synth_presc, df2 = synth_events, drug = "OMEPRAZOLE", timeframe = 30,
drug_id_col = "approved_name", presc_date_col = "presc_date",
ev_date_col = "event_1", date_format = "%Y-%m-%d")

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