
Retrieve date associated with timesteps, transitions, or marginals
Source:R/lookup_date.R
lookup_date.RdRetrieve date associated with timesteps, transitions, or marginals
Arguments
- x
A vector of one of the following formats:
Integer between 1 and
n_timesteps(bf)representing timestep.Character with "T" followed by digits that indicate timesteps, (this format is used internally to label timestep dimensions of objects)
Marginal or Transition names. These start with either "T_" or "M_", and then have two timesteps represented by digits and separated by a dash, E.g. "T_01-02".
- bf
A BirdFlow object
- timestep
Deprecated alternative to
x. Previous versions oflookup_date()only supported timestep input and usedtimestepas the first argument.
Label dates
Each timestep (week) is labeled with its midpoint date. For example week 1 runs from January 1 to 7 and is labeled January 4, its midpoint.
Each transition or marginal spans from the midpoint of its first
timestep to the midpoint of its second, and is labeled with the
midpoint of that span. So transition T_01-02, which stretches from
January 4 (midpoint and label for week 1) to
January 11 (midpoint and label of week 2),
is labeled January 7 - the midpoint between the two.
Examples
# \donttest{
bf <- BirdFlowExamples::amewoo
lookup_date(1:5, bf)
#> [1] "2023-01-04" "2023-01-11" "2023-01-18" "2023-01-25" "2023-02-01"
# }