Learn R Programming

R package drugprepr

Belay B. Yimer, David A. Selby, Meghna Jani, Goran Nenadic, Mark Lunt, William G. Dixon

An algorithm for the transparent and efficient preparation of electronic prescription data into information on individuals’ drug use over time. The goal of the drugprepr package is to allow users to perform multiverse analyses in a concise and easily interpretable manner. The drugprepr package allows researchers to specify sets of defensible data processing options at each decision node (e.g., different ways of imputing missing quantity and daily dose, different ways of handling multiple prescriptions), implement them all, and then report the outcomes of all analyses resulting from all possible choice combinations. The package depends on the R package doseminer for extracting drug dosage information from freetext prescription data.

Installation

You can install the latest development version from GitHub:

devtools::install_github("belayb/drugprepr")

Contributors

Maintained by Belay Birlie Yimer and David Selby of the Centre for Musculoskeletal Research, University of Manchester, UK. Pull requests and GitHub issues are welcomed.

Copy Link

Version

Install

install.packages('drugprepr')

Monthly Downloads

95

Version

0.0.4

License

MIT + file LICENSE

Maintainer

David Selby

Last Published

November 9th, 2021

Functions in drugprepr (0.0.4)

drug_prep

Run drug preparation algorithm
decision_7

Decision 7: impute missing prescription durations
isolate_overlaps

Separating overlapping prescription periods
decision_6

Decision 6: choose method of calculating prescription duration
impute_qty

Find implausible entries Replace implausible or missing prescription quantities
decision_9

Decision 9: handle overlapping prescription periods
outside_range

Do values fall outside a specified 'plausible' range?
shift_interval

Shift time intervals until they no longer overlap
decision_8

Decision 8: disambiguate prescriptions with the same start date
example_therapy

Example electronic prescription dataset
decision_5

Decision 5: impute implausible prescription durations
impute

Impute missing or implausible values
get_mode

Get the mode (most common value) of a vector
impute_ndd

Replace implausible or missing numerical daily doses (NDD)
impute_duration

Replace missing or implausible prescription durations
make_decisions

Human-friendly interface to the drug prep algorithm
min_max_dat

Example min-max data.
decision_10

Decision 10: close small gaps between successive prescriptions
decision_1

Decision 1: impute implausible total quantities
clean_duration

Clean implausibly-long prescription durations
close_small_gaps

Close small gaps between successive prescriptions
decision_4

Decision 4: impute missing daily doses
decision_3

Decision 3: impute implausible daily doses
decision_2

Decision 2: impute missing total quantities
compute_ndd

Compute numerical daily dose from free-text prescribing instructions
dataset1

Example data from the Clinical Practice Research Datalink (CPRD).