cst_deliv_duration {polypharmacy} | R Documentation |
Constant delivery duration drugs
Description
Overwrites the recorded delivery durations of specific drugs with constant durations as specified in a user-provided table.
Usage
cst_deliv_duration(
Rx_deliv,
Rx_drug_code,
Rx_deliv_dur,
Cst_deliv_dur,
Cst_drug_code,
Cst_duration
)
Arguments
Rx_deliv |
Name of the table listing all prescription drugs delivered. |
Rx_drug_code |
Column name of |
Rx_deliv_dur |
Column name of the constant treatment duration in the |
Cst_deliv_dur |
Name of the table that contains the constant delivery durations that will overwrite that in the |
Cst_drug_code |
Column name of |
Cst_duration |
Column name of the constant treatment duration in the |
Value
data.table
of the same structure as Rx_deliv
.
Examples
# With matches
rx1 <- data.frame(id = c(1, 1, 2, 2, 2), code = c("A", "B", "B", "C", "D"),
duration = as.integer(c(30, 15, 15, 7, 90)))
cst1 <- data.frame(CODES = c("B", "D"), DURATION = as.integer(c(45, 60)))
cst_deliv_duration(
Rx_deliv = rx1, Rx_drug_code = "code", Rx_deliv_dur = "duration",
Cst_deliv_dur = cst1, Cst_drug_code = "CODES", Cst_duration = "DURATION"
)
# No matches
rx2 <- data.frame(id = c(1, 1, 2, 2, 2), code = c("A", "B", "B", "C", "D"),
duration = as.integer(c(30, 15, 15, 7, 90)))
cst2 <- data.frame(CODES = c("E", "F"), DURATION = as.integer(c(45, 60)))
cst_deliv_duration(
Rx_deliv = rx2, Rx_drug_code = "code", Rx_deliv_dur = "duration",
Cst_deliv_dur = cst2, Cst_drug_code = "CODES", Cst_duration = "DURATION"
)
[Package polypharmacy version 1.0.0 Index]