Skip to content

Commit

Permalink
Updating virus methods
Browse files Browse the repository at this point in the history
  • Loading branch information
derekmeyer37 committed Aug 28, 2023
1 parent ac36976 commit aa0ada2
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 6 deletions.
4 changes: 4 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,12 @@ S3method(add_tool_n,epiworld_model)
S3method(add_virus,epiworld_model)
S3method(add_virus,epiworld_seir)
S3method(add_virus,epiworld_seirconn)
S3method(add_virus,epiworld_seird)
S3method(add_virus,epiworld_seirdconn)
S3method(add_virus,epiworld_sir)
S3method(add_virus,epiworld_sirconn)
S3method(add_virus,epiworld_sird)
S3method(add_virus,epiworld_sirdconn)
S3method(add_virus_n,epiworld_model)
S3method(add_virus_n,epiworld_seir)
S3method(add_virus_n,epiworld_seirconn)
Expand Down
4 changes: 2 additions & 2 deletions R/ModelSEIRDCONN.R
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@
#' plot(model_seirdconn)
#'
#' # Adding the flu
#' flu <- virus("Flu", .9, 1/7)
#' add_virus(model_seirdconn, flu, .001)
#' flu <- virus("Flu", prob_infecting = .3, recovery_rate = 1/7, prob_death = 0.001)
#' add_virus(model = model_seirdconn, virus = flu, proportion = .001)
#'
#' #' # Running and printing
#' run(model_seirdconn, ndays = 100, seed = 1912)
Expand Down
35 changes: 35 additions & 0 deletions R/virus.R
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,15 @@ add_virus.epiworld_sir <- function(model, virus, proportion) {

}

#' @export
add_virus.epiworld_sird <- function(model, virus, proportion) {

stopifnot_virus(virus)
virus_set_state(virus, init = 1, end = 2, removed = 3)
invisible(add_virus_cpp(model, virus, proportion))

}

#' @export
add_virus.epiworld_sirconn <- function(model, virus, proportion) {

Expand All @@ -168,6 +177,15 @@ add_virus.epiworld_sirconn <- function(model, virus, proportion) {

}

#' @export
add_virus.epiworld_sirdconn <- function(model, virus, proportion) {

stopifnot_virus(virus)
add_virus.epiworld_sird(model, virus, proportion)

}


#' @export
add_virus.epiworld_seir <- function(model, virus, proportion) {

Expand All @@ -177,6 +195,15 @@ add_virus.epiworld_seir <- function(model, virus, proportion) {

}

#' @export
add_virus.epiworld_seird <- function(model, virus, proportion) {

stopifnot_virus(virus)
virus_set_state(virus, init = 1, end = 3, removed = 4)
invisible(add_virus_cpp(model, virus, proportion))

}

#' @export
add_virus.epiworld_seirconn <- function(model, virus, proportion) {

Expand All @@ -185,6 +212,14 @@ add_virus.epiworld_seirconn <- function(model, virus, proportion) {

}

#' @export
add_virus.epiworld_seirdconn <- function(model, virus, proportion) {

stopifnot_virus(virus)
add_virus.epiworld_seird(model, virus, proportion)

}

#' @export
#' @rdname virus
#' @returns
Expand Down
4 changes: 2 additions & 2 deletions man/ModelSEIRD.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/ModelSEIRDCONN.Rd

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

0 comments on commit aa0ada2

Please sign in to comment.