Learn R Programming

WARDEN (version 2.0.0)

modify_event: Modify or add events for a patient

Description

Modifies existing event times, or adds new events if create_if_missing is TRUE.

Usage

modify_event(events, create_if_missing = TRUE, ptr, patient_id)

Value

NULL (invisible). Modifies the queue in-place.

Arguments

events

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).

create_if_missing

Logical, whether to create events if they do not exist.

ptr

The event queue pointer. Defaults to cur_evtlist.

patient_id

The patient ID. Defaults to i.

Details

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.

Examples

Run this code
add_reactevt(name_evt = "idfs",input = {modify_event(c("os"=5))})

Run the code above in your browser using DataLab