View source: R/time_to_onset.R
time_to_onset | R Documentation |
Only applicable for inpatients. Where date of specimen is before the date of
admission, NA
will be returned.
time_to_onset(date_admitted, date_specimen, patient_category, patient_location)
date_admitted |
Admission date in date format |
date_specimen |
Date specimen taken in date format |
patient_category |
Category of patient at time of specimen. One of: "In-patient", "Day patient" or "Emergency Assessment" |
patient_location |
Location of patient at time of specimen |
A numeric value
onset <- lubridate::dmy("05-01-2011")
admitted <- lubridate::dmy("01-01-2011")
patient_cat <- "In-patient"
patient_loc <- "NHS Acute Trust"
time_to_onset(admitted, onset, patient_cat, patient_loc)
dat <- data.frame(onset = onset, admitted = admitted, patient_cat = patient_cat,
patient_loc = patient_loc)
dat$tto <- time_to_onset(dat$admitted, dat$onset, dat$patient_cat, dat$patient_loc)
## Not run:
## Should return NA
onset <- NA
time_to_onset(admitted, onset, patient_cat, patient_loc)
patient_cat <- ""
onset <- lubridate::dmy("05-01-2011")
time_to_onset(admitted, onset, patient_cat)
time_to_onset(date_admitted = lubridate::dmy("01-01-2011"),
date_specimen = lubridate::dmy("05-01-2011"),
patient_category = "Outpatient", patient_location = "NHS Acute Trust")
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.