Skip to contents

This helper function streamlines the calculation of piecewise steps. This may be useful when specifying random walks, AR processes, etc.

Usage

piecewise_steps(t, step, offset = 0, steps_post_offset = TRUE)

Arguments

t

Integer, the timespan over which to calculate steps

step

Integer, the frequency at which to step.

offset

Integer, the amount to offset steps. This can be used to index steps from this index.

steps_post_offset

Logical, defaults to TRUE. Should steps be added after the offset.

Value

A list containing two elements: n (the number of steps) and steps

the location of steps as a binary variable.

See also

Preprocessing functions filter_by_availability(), fv_dow_period(), latest_obs()