new_users_fixed: Determine New vs. Ongoing Use of a Drug of Interest, Fixed...

Description Usage Arguments Value Examples

View source: R/use_at_time.R

Description

Classifies patients as new or ongoing users of the drug(s) of interest based on whether or not they have prescriptions within a lookback period based on a standardised start date for all patients

Usage

1
2
3
4
new_users_fixed(df, drug, start_date = NULL, timeframe = 0,
  return_all = 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 prescription 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

start_date

a string containing the date to start follow-up - any prescriptions before this date are used to indicate ongoing use

timeframe

a number representing the length, in days, of the timeframe before the start date to check for previous prescriptions

return_all

a logical, if TRUE the function will return data for all patients as well as flags indicating if they were exposed during follow-up and if they are new users. If FALSE, returns only new users exposed during follow-up

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 prescription date

date_format

a string, the format of the dates contained in df and the start_date argument

Value

A data frame containing patient IDs, flags indicating if the patient was a new user at the start date and if they were exposed during follow-up, and where applicable the date of the first prescription during follow-up

Examples

1
2
new_users_fixed(synth_presc, drug = "SIMVASTATIN", start_date = "2021-01-01", timeframe = 90,
presc_date_col = "presc_date", drug_id_col = "approved_name")

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