Description Usage Arguments Details Value Examples
calc_runtime
calculates the duration of time at current value and
total run time
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | calc_runtime(x, ...)
## Default S3 method:
calc_runtime(x, ...)
## S3 method for class 'meds_cont'
calc_runtime(x, ..., drip.off = 12, no.doc = 24,
units = "hours")
## S3 method for class 'meds_inpt'
calc_runtime(x, ..., drip.off = 12, no.doc = 24,
units = "hours", cont = TRUE)
## S3 method for class 'events'
calc_runtime(x, ..., units = "hours")
## S3 method for class 'labs'
calc_runtime(x, ..., units = "hours")
## S3 method for class 'meds_sched'
calc_runtime(x, ..., units = "hours")
## S3 method for class 'vitals'
calc_runtime(x, ..., units = "hours")
|
x |
A data frame with serial measurement data |
... |
optional grouping variables |
drip.off |
An optional numeric indicating the number of hours a medication infusion should be off to count as a new infusion, defaults to 12 hours |
no.doc |
An optional numeric indicating the number of hours without documentation which will be used to indicate a drip has ended, defaults to 24 hours |
units |
An optional character string specifying the time units to use in calculations, default is hours |
cont |
A logical, if TRUE (default), treat the medications as continuous when summarizing |
This function takes a data frame with serial measurement data (e.g., continuous medications or repeated lab data) and produces a data frame with the with the duration of time at each value and cumulative run time.
This could be used to then calculate the AUC or to summarize the continuous data.
For continuous medications, the data will be grouped into distinct
sets of infusions, for patients who may have been restarted on the drip one
or more times. Use the drip.off
argument to modify the criteria for
determining distinct infusions.
A data frame
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | # make a reference data frame for tidying meds
ref <- tibble::tibble(
name = c("heparin", "warfarin", "antiplatelet agents"),
type = c("med", "med", "class"),
group = c("cont", "sched", "sched")
)
# tidy continuous medications; will keep only heparin drips
x <- tidy_data(meds_cont, meds_sched, ref)
# calculate the runtime for continuous heparin infusion
print(head(
calc_runtime(x)
))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.