
Append trailing-average rows in long form to econanalyzr data frame
Source:R/econ_calc_trail_avg.R
econ_calc_trail_avg.Rd
Computes a trailing (right-aligned) moving average of value
and appends
those rows to the original data (long form).
Details
Input must pass
check_econanalyzr_df()
.trail_amount
must be a positive, integer-ish scalar (e.g., 3L, 6).If
df
is a grouped tibble (viadplyr::group_by()
), the trailing average is computed within each group. If ungrouped, it is computed over the entire table.Derived rows have
data_transform_text
appended with"; Trail {n}"
.Windows are right-aligned with
.complete = TRUE
: the firsttrail_amount - 1
rows per group areNA
.