newStateLogger {ABM} | R Documentation |
Create a logger of the StateLogger class
Description
When state changes occur, it is passed to each logger, which then change its value. At the specified time points in a run, the values of the logger are reported and recorded in a data.frame object, where the columns represent variables, and rows represent the observation at each time point given to each run. Each logger has a name, which becomes the the column name in the data.frame.
Arguments
name |
the name of the logger. A length-1 character vector |
agent |
the agent whose state will be logged. An external pointer |
state.name |
the state name of the state of the agent to be logged. A character vector of length 1. |
Details
If a state changed happened to any agent, the specified state
of the agent given by the "agent" argument will be logged. If
state.name==NULL
then the state of the agent who just changed is
logged.
The agent must be an external pointer. To use an R6 object, we need to use its $get method to get the external pointer.
The state to be logged must have a numeric value.