Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

more examples #17

Merged
merged 3 commits into from
Jul 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions R/calc_new_immunity.R
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,21 @@ assert_valid_targeting <- function(x, name = deparse(substitute(x))) {
##' @return A dataframe containing the `popim_population` aggregated by age.
##' @author Tini Garske
##' @export
##' @examples
##' ## set up population and vaccination activities:
##' pop <- popim_population(region = "UK", year_min = 2000, year_max = 2005,
##' age_min = 0, age_max = 10)
##' vacc <- popim_vacc_activities(region = "UK", year = c(2001, 2002),
##' age_first = 0, age_last = 0,
##' coverage = 0.8, doses = NA,
##' targeting = "random")
##'
##' ## update the population immunity based on the vaccination activities:
##' pop <- apply_vacc(pop, vacc)
##'
##' ## calculate the population immunity aggregated across ages:
##' pop_aggregated <- calc_pop_immunity(pop)
##'
calc_pop_immunity <- function(pop) {

assert_population(pop)
Expand Down
18 changes: 18 additions & 0 deletions R/plotting.R
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,24 @@ NULL
##' @rdname plotting
##' @export
##' @author Tini Garske
##' @examples
##' ## set up population and vaccination activities:
##' pop <- popim_population(region = "UK", year_min = 2000, year_max = 2005,
##' age_min = 0, age_max = 10)
##' vacc <- popim_vacc_activities(region = "UK", year = c(2001, 2002),
##' age_first = 0, age_last = 0,
##' coverage = 0.8, doses = NA,
##' targeting = "random")
##'
##' ## update the population immunity based on the vaccination activities:
##' pop <- apply_vacc(pop, vacc)
##'
##' ## plot the population size by age and time:
##' plot_pop_size(pop)
##'
##' ## plot the population immunity by age and time:
##' plot_immunity(pop)
##'
plot_immunity <- function(pop) {

assert_population(pop)
Expand Down
15 changes: 15 additions & 0 deletions R/popim_vacc_activities.R
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,21 @@ as_vacc_activities <- function(df) {
##' updated to have both `doses` and `coverage` information.
##' @author Tini Garske
##' @export
##' @examples
##' ## set up some vaccination activities:
##' vacc <- popim_vacc_activities(region = "UK", year = 2001:2003,
##' age_first = 0, age_last = 0,
##' coverage = c(0.8, 0.8, NA),
##' doses = c(NA, NA, 60),
##' targeting = "random")
##' ## set up a population to which these activities shall apply:
##' pop <- popim_population(region = "UK", year_min = 2000, year_max = 2005,
##' age_min = 0, age_max = 10)
##' pop$pop_size <- 100 ## cohort size of 100 for all cohorts
##'
##' ## fill in missing coverage/doses information based on population size:
##' vacc <- complete_vacc_activities(vacc, pop)
##'
complete_vacc_activities <- function(vacc, pop) {
validate_vacc_activities(vacc)
stopifnot(is_population(pop))
Expand Down
16 changes: 16 additions & 0 deletions man/calc_pop_immunity.Rd

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

16 changes: 16 additions & 0 deletions man/complete_vacc_activities.Rd

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

19 changes: 19 additions & 0 deletions man/plotting.Rd

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

Loading