get_agents {epiworldR}R Documentation

Agents in epiworldR

Description

These functions provide read-access to the agents of the model. The get_agents function returns an object of class epiworld_agents which contains all the information about the agents in the model. The get_agent function returns the information of a single agent. And the get_state function returns the state of a single agent.

Usage

get_agents(model)

## S3 method for class 'epiworld_agents'
x[i]

## S3 method for class 'epiworld_agent'
print(x, compressed = FALSE, ...)

## S3 method for class 'epiworld_agents'
print(x, compressed = TRUE, max_print = 10, ...)

get_state(x)

Arguments

model

An object of class epiworld_model.

x

An object of class epiworld_agents

i

Index (id) of the agent (from 0 to n-1)

compressed

Logical scalar. When FALSE, it prints detailed information about the agent.

...

Ignored

max_print

Integer scalar. Maximum number of agents to print.

Value

See Also

agents

Examples

 
model_sirconn <- ModelSIRCONN(
name                = "COVID-19",
n                   = 10000,
prevalence          = 0.01,
contact_rate        = 5,
transmission_rate   = 0.4,
recovery_rate       = 0.95
)

run(model_sirconn, ndays = 100, seed = 1912)

x <- get_agents(model_sirconn) # Storing all agent information into object of 
                               # class epiworld_agents
                             
print(x, compressed = FALSE, max_print = 5) # Displaying detailed information of 
                                        # the first 5 agents using 
                                        # compressed=F. Using compressed=T
                                        # results in less-detailed 
                                        # information about each agent. 
                                        
x[0] # Print information about the first agent. Substitute the agent of 
     # interest's position where '0' is. 

[Package epiworldR version 0.1-0 Index]