if (require(mimic.demo)) {
gluc <- item("mimic_demo", "labevents", "itemid", list(c(50809L, 50931L)),
unit_var = TRUE, target = "ts_tbl")
is_item(gluc)
all.equal(gluc, as_item(load_dictionary("mimic_demo", "glu")))
hr1 <- new_itm(src = "mimic_demo", table = "chartevents",
sub_var = "itemid", ids = c(211L, 220045L))
hr2 <- item(src = c("mimic_demo", "eicu_demo"),
table = c("chartevents", "vitalperiodic"),
sub_var = list("itemid", NULL),
val_var = list(NULL, "heartrate"),
ids = list(c(211L, 220045L), FALSE),
class = c("sel_itm", "col_itm"))
hr3 <- new_itm(src = "eicu_demo", table = "vitalperiodic",
val_var = "heartrate", class = "col_itm")
identical(as_item(hr1), hr2[1])
identical(new_item(list(hr1)), hr2[1])
identical(hr2, as_item(list(hr1, hr3)))
}
Run the code above in your browser using DataLab