aggregate.epichains {epichains} | R Documentation |
<epichains>
objects by "generation" or "time", if
presentThis function provides a quick way to create a time series of cases over
generation or time (if generation_time
was specified) from simulated
<epichains>
objects.
## S3 method for class 'epichains'
aggregate(x, by = c("time", "generation"), ...)
x |
An |
by |
The variable to aggregate by; A character string with options "time" and "generation". |
... |
Not used. |
A <data.frame>
object of cases by by
.
James M. Azam
set.seed(32)
chains <- simulate_chains(
n_chains = 10,
statistic = "size",
offspring_dist = rpois,
stat_threshold = 10,
generation_time = function(n) rep(3, n),
lambda = 2
)
chains
# Aggregate cases per time
cases_per_time <- aggregate(chains, by = "time")
head(cases_per_time)
# Aggregate cases per generation
cases_per_gen <- aggregate(chains, by = "generation")
head(cases_per_gen)