cover_special_periods {AdhereR} | R Documentation |
Cover special periods.
Description
Identifies special periods that are in proximity to already covered durations and adds additional events for these durations.
Usage
cover_special_periods(
events.data,
special.periods.data,
ID.colname,
medication.class.colnames,
disp.date.colname,
disp.start.colname,
episode.start.colname,
episode.end.colname,
duration.colname,
days.before,
days.after,
date.format,
suppress.warnings = FALSE,
return.data.table = FALSE,
...
)
Arguments
events.data |
A |
special.periods.data |
a |
ID.colname |
A string, the name of the column in |
medication.class.colnames |
A |
disp.date.colname |
A string, the name of the column in
|
disp.start.colname , episode.start.colname , episode.end.colname |
column names in
|
duration.colname |
A string, the name of the column in
|
days.before |
an integer, the number of days before the start of a special period within which an event duration must end to consider the special period as covered. |
days.after |
an integer, the number of days after a special period within which an event duration must start to consider the special period as covered. |
date.format |
A string giving the format of the dates used in
the |
suppress.warnings |
Logical, if |
return.data.table |
Logical, if |
... |
other possible parameters. |
Details
Special periods may appear as gaps, possibly leading to underestimation of implementation or even
assumption of discontinuation and non-persistence. To consider such periods as covered, this function
adds additional durations, for example when it is assumed that hospitalized patients are adherent
during the hospitalization period. This function should be used after pruning with
prune_event_durations
.
Value
A data.frame
or data.table
, the events.data
with the additional
durations for special periods covered.
Examples
## Not run:
# select medication class of interest and compute event durations
disp_data <- durcomp.dispensing[ID == 3 & grepl("J01EE01", ATC.CODE)]
presc_data <- durcomp.prescribing[ID == 3 & grepl("J01EE01", ATC.CODE)]
event_durations_list <- compute_event_durations(disp.data = disp_data,
presc.data = presc_data,
special.periods.data = durcomp.hospitalisation,
special.periods.method = "carryover",
ID.colname = "ID",
presc.date.colname = "DATE.PRESC",
disp.date.colname = "DATE.DISP",
date.format = "%Y-%m-%d",
medication.class.colnames = c("ATC.CODE",
"UNIT",
"FORM"),
total.dose.colname = "TOTAL.DOSE",
presc.daily.dose.colname = "DAILY.DOSE",
presc.duration.colname = "PRESC.DURATION",
visit.colname = "VISIT",
force.init.presc = TRUE,
force.presc.renew = TRUE,
split.on.dosage.change = TRUE,
trt.interruption = "carryover",
suppress.warnings = FALSE,
return.data.table = TRUE,
progress.bar = FALSE)
event_durations <- prune_event_durations(event_durations_list,
include = c("special periods"),
medication.class.colnames = "ATC.CODE",
days.within.out.date.1 = 7,
days.within.out.date.2 = 30,
keep.all = TRUE)
# cover special periods
special_periods <- event_durations_list$special_periods
event_durations_covered <- cover_special_periods(events.data = event_durations,
special.periods.data = special_periods,
ID.colname = "ID",
medication.class.colnames = "ATC.CODE",
disp.start.colname = "DISP.START",
duration.colname = "DURATION",
days.before = 7,
days.after = 7,
date.format = "%Y-%m-%d")
## End(Not run)