Learn R Programming

SimInf (version 5.1.0)

recovered: Recovered

Description

Extracts the number of recovered

Usage

recovered(model, ...)

# S4 method for SEIR recovered(model, i = NULL, ...)

# S4 method for SIR recovered(model, i = NULL, ...)

Arguments

model

The model to extract the recovered from

...

Additional arguments affecting the measure

i

Indices specifying the nodes to include when extracting the number of recovered. Default is NULL, which includes all nodes.

Examples

Run this code
# 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 recovered individuals in each
## node after each time step in the simulation
recovered(result)

## Extract the number of recovered individuals in the
## first node after each time step in the simulation
recovered(result, i = 1)

## Extract the number of recovered individuals in the
## first and third node after each time step in the simulation
recovered(result, i = c(1, 3))
# }

Run the code above in your browser using DataLab