| data_writer {villager} | R Documentation |
Data Writer
Description
A class responsible for the simulation data to disk.
Details
This class can be subclasses to provide advanced data writing to other data sources. This should also be subclassed if the agent and resource classes are subclasses, to write any additional fields to the data source.
Methods
write()Writes the agent and resources to disk.
Create a new data writer.
Public fields
results_directoryThe folder where the simulation results are written to
agent_filenameThe location where the agents are written to
resource_filenameThe location where the resources are written to
Methods
Public methods
Method new()
Creates a new data writer object that has optional paths for data files.
Usage
data_writer$new( results_directory = "results", agent_filename = "agents.csv", resource_filename = "resources.csv" )
Arguments
results_directoryThe directory where the results file is written to
agent_filenameThe name of the file for the agent data
resource_filenameThe name of the file for the resource data
Returns
A new agent object Writes a village's state to disk.
Method write()
Takes a state an the name of a village and writes the agents and resources to disk
Usage
data_writer$write(state, village_name)
Arguments
stateThe village's village_state that's being written
village_nameThe name of the village. This is used to create the data directory
Returns
None
Method clone()
The objects of this class are cloneable with this method.
Usage
data_writer$clone(deep = FALSE)
Arguments
deepWhether to make a deep clone.