uat_fixed: Use at Time Point, Fixed Date Range

Description Usage Arguments Value Examples

View source: R/use_at_time.R

Description

Determines which patients have been exposed to the drug(s) of interest within a timeframe of interest. This function applies the same timeframe to all prescriptions - by default it considers all prescriptions before or after the date provided, but a number of days can be entered to give a more specific timeframe.

Usage

1
2
3
4
uat_fixed(df, drug, date_1, flatten = FALSE, timeframe = 0,
  forward = TRUE, 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

date_1

a string containing a date to base the follow-up window on

flatten

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

timeframe

a number representing the length of the follow-up window. If 0 as by default any prescriptions before or after (depending on the value of forward) the date entered in date_1 will be considered

forward

a logical, if TRUE the value of timeframe will be added to the value of date_1 to generate an end date for the follow-up window. If FALSE, the value will be subtracted to generate a start date

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 a list of patient IDs for patients who have at least one prescription matching the criteria, the number of prescriptions within the defined date window and the date of the first matching prescription

Examples

1
2
3
4
5
uat_fixed(synth_presc, drug = "ATORVASTATIN", date_1 = "01/07/2020",
drug_id_col = "approved_name", presc_date_col = "presc_date", date_format = "%Y-%m-%d")
uat_fixed(synth_presc, drug = "SIMVASTATIN", date_1 = "01/01/2021", timeframe = 180,
forward = FALSE, 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.