Modifies existing event times, or adds new events if create_if_missing
is TRUE.
modify_event(events, create_if_missing = TRUE, ptr, patient_id)
NULL (invisible). Modifies the queue in-place.
A named numeric vector with event names and new event times. It can also handle lists instead of named vectors (at a small computational cost).
Logical, whether to create events if they do not exist.
The event queue pointer. Defaults to cur_evtlist
.
The patient ID. Defaults to i
.
The functions to add/modify events/inputs use named vectors or lists. Whenever several inputs/events are added or modified, it's recommended to group them within one function, as it reduces the computation cost.
So rather than use two modify_event
with a list of one element, it's better to group them into a single modify_event
with a list of two elements.
This function does not evaluate sequentially.
While multiple events can be added, they must be named differently. If the same event is added multiple times at once, only the last occurrence will be kept (only one event per event type in the queue of events yet to occur). If an event occurs, then a new one with the same name can be set.
This function is intended to be used only within the add_reactevt
function in its input
parameter and should not be run elsewhere or it will return an error.
add_reactevt(name_evt = "idfs",input = {modify_event(c("os"=5))})
Run the code above in your browser using DataLab