merge_projections: Merge a list of projections objects

View source: R/merge_projections.R

merge_projectionsR Documentation

Merge a list of projections objects

Description

This function merges projections objects, binding them by columns, making sure that they all use the same dates, adding rows of '0' where needed.

Usage

merge_projections(x)

Arguments

x

A list of projections objects to be merged.

Author(s)

Thibaut Jombart

Examples


## generate toy data
dates <- Sys.Date() + c(0, 0, 2, 5, 6, 6, 7)
i <- incidence::incidence(dates)
si <- c(0.2, 0.5, 0.2, 0.1)
R0 <- 3.5

## make several projections objects
x <- lapply(1:10,
            function(j)
              project(x = i,
                      si = si,
                      R = R0,
                      n_sim = 2 * j,
                      R_fix_within = TRUE,
                      n_days = j,
                      model = "poisson"
                      ))
## see all dimensions
lapply(x, dim)
merge_projections(x)

projections documentation built on March 31, 2023, 7:18 p.m.