tidy_presc: Standardise Input Data Field Names and Formats

Description Usage Arguments Value Examples

View source: R/standardising.R

Description

Adjusts the field names and data formats of prescribing and events data to create a data frame in a format suited for use with the other functions in this package - mostly called internally by the other functions in this package, but can be used directly by the user to reduce the number of arguments which need to be passed to other functions as these standardised values are inluded as the default values in their code.

Usage

1
2
3
4
tidy_presc(df, patient_id_col = NULL, drug_id_col = NULL,
  presc_date_col = NULL, dd_disp_col = NULL, qty_disp_col = NULL,
  qty_per_day_col = NULL, ev_date_1_col = NULL, ev_date_2_col = NULL,
  date_format)

Arguments

df

a data frame containing the data of interest

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

dd_disp_col

a string, the name of the column in df containing the number of daily doses dispensed

qty_disp_col

a string, the name of the column in df containing the quantity of drug dispensed

qty_per_day_col

a string, the name of the column in df containing the quantity of drug to be taken per day

ev_date_1_col

a string, the name of the column containing the first event dates

ev_date_2_col

a string, the name of the column containing the second event dates if present

date_format

a string, the format of the dates in df

Value

a data frame with standardised field names and formats

Examples

1
2
3
4
5
tidy_synth <- tidy_presc(df = synth_presc, drug_id_col = "approved_name",
 dd_disp_col = "ddd_dispensed", qty_disp_col = "qty_dispensed",
 date_format = "%Y-%m-%d")
tidy_synth <- tidy_presc(synth_events, patient_id = "patient_id",
ev_date_1 = "start_date")

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