
Last chance! 50% off unlimited learning
Sale ends in
Extracts the number of infected
infected(model, ...)# S4 method for SEIR
infected(model, i = NULL, ...)
# S4 method for SIR
infected(model, i = NULL, ...)
# S4 method for SISe
infected(model, i = NULL, ...)
# S4 method for SISe3
infected(model, age = 1:3, i = NULL, ...)
# S4 method for SISe3_sp
infected(model, age = 1:3, i = NULL, ...)
# S4 method for SISe_sp
infected(model, i = NULL, ...)
The model
to extract the infected from
Additional arguments affecting the measure
Indices specifying the nodes to include when extracting the number of infected. Default is NULL, which includes all nodes.
For models with age categories, the age category to extract.
# NOT RUN {
## Create an 'SIR' model with 5 nodes and initialize
## it to run over 10 days.
u0 <- data.frame(S = rep(99, 5), I = rep(1, 5), R = rep(0, 5))
model <- SIR(u0 = u0, tspan = 1:10, beta = 0.16, gamma = 0.077)
## Run the model and save the result
result <- run(model, threads = 1, seed = 1)
## Extract the number of infected individuals in each
## node after each time step in the simulation
infected(result)
## Extract the number of infected individuals in the
## first node after each time step in the simulation
infected(result, i = 1)
## Extract the number of infected individuals in the
## first and fifth node after each time step in the simulation
infected(result, i = c(1, 5))
# }
Run the code above in your browser using DataLab