This adds a dosing event to the event table. This is provided for piping syntax through magrittr. It can also be accessed by eventTable$add.dosing(...)

add.dosing(
  eventTable,
  dose,
  nbr.doses = 1L,
  dosing.interval = 24,
  dosing.to = 1L,
  rate = NULL,
  amount.units = NA_character_,
  start.time = 0,
  do.sampling = FALSE,
  time.units = NA_character_,
  ...
)

Arguments

eventTable

eventTable object; When accessed from object it would be eventTable$

dose

numeric scalar, dose amount in amount.units;

nbr.doses

integer, number of doses;

dosing.interval

required numeric scalar, time between doses in time.units, defaults to 24 of time.units="hours";

dosing.to

integer, compartment the dose goes into (first compartment by default);

rate

for infusions, the rate of infusion (default is NULL, for bolus dosing;

amount.units

optional string indicating the dosing units. Defaults to NA to indicate as per the original EventTable definition.

start.time

required dosing start time;

do.sampling

logical, should observation sampling records be added at the dosing times? Defaults to FALSE.

time.units

optional string indicating the time units. Defaults to "hours" to indicate as per the original EventTable definition.

...

Other parameters passed to et().

Value

eventTable with updated dosing (note the event table will be updated anyway)

References

Wang W, Hallow K, James D (2015). "A Tutorial on rxode2: Simulating Differential Equation Pharmacometric Models in R." CPT: Pharmacometrics and Systems Pharmacology, 5(1), 3-10. ISSN 2163-8306, <URL: https://www.ncbi.nlm.nih.gov/pmc/articles/PMC4728294/>.

See also

Author

Matthew L. Fidler

Matthew L Fidler, Wenping Wang

Examples


# \donttest{

library(units)
#> udunits database from /usr/share/xml/udunits/udunits2.xml

## These are making the more complex regimens of the rxode2 tutorial

## bid for 5 days
bid <- et(timeUnits="hr") %>%
       et(amt=10000,ii=12,until=set_units(5, "days"))

## qd for 5 days
qd <- et(timeUnits="hr") %>%
      et(amt=20000,ii=24,until=set_units(5, "days"))

## bid for 5 days followed by qd for 5 days

et <- seq(bid,qd) %>% et(seq(0,11*24,length.out=100));


## Now Infusion for 5 days followed by oral for 5 days

##  note you can dose to a named compartment instead of using the compartment number
infusion <- et(timeUnits = "hr") %>%
      et(amt=10000, rate=5000, ii=24, until=set_units(5, "days"), cmt="centr")


qd <- et(timeUnits = "hr") %>% et(amt=10000, ii=24, until=set_units(5, "days"), cmt="depot")

et <- seq(infusion,qd)


## 2wk-on, 1wk-off

qd <- et(timeUnits = "hr") %>% et(amt=10000, ii=24, until=set_units(2, "weeks"), cmt="depot")

et <- seq(qd, set_units(1,"weeks"), qd) %>%
     add.sampling(set_units(seq(0, 5.5,by=0.005),weeks))


## You can also repeat the cycle easily with the rep function

qd <-et(timeUnits = "hr") %>% et(amt=10000, ii=24, until=set_units(2, "weeks"), cmt="depot")

et <- etRep(qd, times=4, wait=set_units(1,"weeks")) %>%
     add.sampling(set_units(seq(0, 12.5,by=0.005),weeks))


# }