newEvent {ABM} | R Documentation |
Creates a new event in R
Description
Creates a new event in R
Arguments
time |
the time that this event will occur. A length-1 numeric vector. |
handler |
an R function that handles the event when it occurs. |
Details
The R handler function should take exactly 3 arguments
time: the current time in the simulation
sim: the simulation object, an external pointer
agent: the agent to whom this event is attached to.
The return value of the handler function is ignored.
This function avoids the overhead of an R6 class, and is thus faster. This is the recommended method to create an event in an event handler.
Value
an external pointer, which can then be passed to functions such as schedule and unschedule.
[Package ABM version 0.4.1 Index]