library(magrittr)
# First option: work with a data.frame
adm_rows(amt = 1000, cmt = 1, addl = 4, ii = 12) %>%
obs_rows(time = c(12.3, 45.6), DV = c(.111, .222), cmt = 2) %>%
obs_rows(time = 48, cmt = 2) %>%
add_covariates(BW = 90, SEX = 0, TOLA = TRUE)
# You can even inform "time" using date and hours:
adm_rows(amt = 1000, cmt = 1, addl = 4, ii = 12, .datehour = "2022-01-01 11:11:11") %>%
obs_rows(.datehour = "2022-01-02 22:22:22", DV = 0.111, cmt = 2)
# Second option: work with a dataset within a 'mrgsolve' model
# \donttest{
mod <- exmodel(add_exdata = FALSE)
# call `mrgsolve::see(mod)` to see how default compartment were coded
adm_cmt(mod)
obs_cmt(mod)
mod %>%
adm_rows(amt = 10000) %>%
obs_rows(time = c(1.5, 4.4, 7.5, 24.6), DV = c(91.2904, 110.826, 79.384, 20.6671)) %>%
# get_data() # for curiosity, you can extract the data set at this step
mapbayest()
# }
Run the code above in your browser using DataLab