treelist_to_paths: Compute paths from a list of trees

Description Usage Arguments Value

View source: R/path-functions.R

Description

This function computes paths from all trees at once; it is much faster than iterating over trees (e.g. as one would do using purrr::map).

Usage

1
treelist_to_paths(treelist, tmax, equalize = TRUE)

Arguments

treelist

A list of lists. Each sublist corresponds to a single tree (i.e. a simulated path). Each tree is itself a list of tibbles, with one tibble for each depth level.

tmax

A positive scalar. The cut point for paths.

equalize

A logical scalar. If TRUE, make all paths end at t_max by calling equalize_paths.

Value

A data.frame with columns id_sim (unique path ID), time, n_infected (cumulative number infected – strictly increasing), n_infectious (number currently infectious).


pspc-data-science/branchsim documentation built on Jan. 19, 2021, 10:10 a.m.