Convert the trajectories held by a filter or unfilter after
dust2::dust_likelihood_run() into a long-format tibble. Times and
group names are read from the filter.
Usage
tidy_filter(
obj,
select_random_particle = FALSE,
index_state = NULL,
vars = NULL,
dims = NULL,
labels = NULL
)Arguments
- obj
A
dust_likelihoodobject, created bydust2::dust_filter_create()ordust2::dust_unfilter_create(), that has been run withsave_trajectories = TRUE.- select_random_particle
Logical, passed to
dust2::dust_likelihood_last_trajectories(): return a single randomly selected particle rather than all of them.- index_state
The
index_statepassed todust2::dust_likelihood_run(), if any.- vars
Optional character vector of variables to keep, for example
c("I", "incidence"). Selecting variables before reshaping is much cheaper than filtering afterwards.- dims
Optional names for the dimensions of array variables. Either an unnamed character vector applied by position to every array variable (
c("age", "vax")), or a named list giving the dimension names of each variable (list(S = c("age", "vax"), R = "age")). Dimensions that are not named produce columnsindex1,index2, and so on.- labels
Optional named list of labels for dimensions, for example
list(age = c("child", "adult")). Labelled dimensions become factors. Use the namegroupto label parameter groups.