Skip to content

Commit

Permalink
Add example to the 'infected' method
Browse files Browse the repository at this point in the history
  • Loading branch information
stewid committed Nov 29, 2015
1 parent 27ed5c8 commit 2d0f3c6
Show file tree
Hide file tree
Showing 4 changed files with 102 additions and 5 deletions.
52 changes: 50 additions & 2 deletions R/AllGenerics.R
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,8 @@ setGeneric("run",
##' ## Run the model and save the result
##' result <- run(model)
##'
##' ## Extract the sum all of susceptible individuals in each age
##' ## category in each node after each time step in the simulation
##' ## Extract the sum all of susceptible individuals in all age
##' ## categories in each node after each time step in the simulation
##' susceptible(result)
##'
##' ## Extract the number of susceptible individuals in the first age
Expand Down Expand Up @@ -121,6 +121,54 @@ setGeneric("susceptible",
##' infected at every time point.
##' @keywords methods
##' @export
##' @examples
##' ## Create a 'SISe' demo model with 5 nodes and initialize
##' ## it to run over 10 days.
##' model <- demo_model(nodes = 5, days = 10, model = "SISe")
##'
##' ## Run the model and save the result
##' result <- run(model)
##'
##' ## 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 third node after each time step in the simulation
##' infected(result, i = c(1, 3))
##'
##' ## Extract the number of infected individuals in the first
##' ## and third node after every other time step in the simulation
##' infected(result, i = c(1, 3), by = 2)
##'
##' ## Create a 'SISe3' demo model with 5 nodes and initialize
##' ## it to run over 10 days.
##' model <- demo_model(nodes = 5, days = 10, model = "SISe3")
##'
##' ## Run the model and save the result
##' result <- run(model)
##'
##' ## Extract the sum all of infected individuals in all age
##' ## categories in each node after each time step in the simulation
##' infected(result)
##'
##' ## Extract the number of infected individuals in the first age
##' ## category in each node after each time step in the simulation
##' infected(result, age = 1)
##'
##' ## Extract the sum of infected individuals in the first and
##' ## second age category in each node after each time step in
##' ## the simulation
##' infected(result, age = c(1, 2))
##'
##' ## Extract the number of infected individuals in the first age
##' ## category in the first and third node after each time step in
##' ## the simulation
##' infected(result, i = c(1, 3), age = 1)
setGeneric("infected",
function(model, ...) standardGeneric("infected"))

Expand Down
49 changes: 49 additions & 0 deletions man/infected-methods.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/run-methods.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions man/susceptible-methods.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 2d0f3c6

Please sign in to comment.