miller/test/cases/verb-stats1
John Kerl 10939349d2
Add sliding-window mode to mlr stats1 via -w {n} (#1017) (#2186)
* Add sliding-window mode to stats1 via -w {n} (#1017)

This adds a generic sliding-window option to the stats1 verb, per the
feature request in #1017. With 'mlr stats1 ... -w {n}', statistics are
computed over a trailing window of up to n records -- per group when -g
is used -- and one output record is emitted per input record, with the
windowed statistics appended to it.

The implementation retains, per grouping key, copies of only the
relevant value fields from the last up-to-n records. On each input
record the group's accumulators are reset and re-fed from the window.
This is O(window size) per record, but is fully generic: it works
uniformly for every stats1 accumulator, including order-sensitive ones
(mode, antimode) and non-invertible ones (percentiles, distinct_count),
and composes with -g, --fr/--fx, and --gr/--gx.

Includes unit tests, regression cases (test/cases/verb-stats1/0020-0025),
and regenerated docs/man/help-text artifacts.

Addresses #1017.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* neaten

---------

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-07-14 10:24:41 -04:00
..
0001 Add mad accumulator for stats1 DSL function (#1561) 2024-05-11 15:55:27 -04:00
0002 Use fixed OFMT for multi-platform regression-testing (#988) 2022-03-16 14:44:42 -04:00
0003 Use fixed OFMT for multi-platform regression-testing (#988) 2022-03-16 14:44:42 -04:00
0004 Use fixed OFMT for multi-platform regression-testing (#988) 2022-03-16 14:44:42 -04:00
0005 Use fixed OFMT for multi-platform regression-testing (#988) 2022-03-16 14:44:42 -04:00
0006 Use fixed OFMT for multi-platform regression-testing (#988) 2022-03-16 14:44:42 -04:00
0007 Use fixed OFMT for multi-platform regression-testing (#988) 2022-03-16 14:44:42 -04:00
0008 Use fixed OFMT for multi-platform regression-testing (#988) 2022-03-16 14:44:42 -04:00
0009 Use fixed OFMT for multi-platform regression-testing (#988) 2022-03-16 14:44:42 -04:00
0010 Use fixed OFMT for multi-platform regression-testing (#988) 2022-03-16 14:44:42 -04:00
0011 Use fixed OFMT for multi-platform regression-testing (#988) 2022-03-16 14:44:42 -04:00
0012 Use fixed OFMT for multi-platform regression-testing (#988) 2022-03-16 14:44:42 -04:00
0013 Use fixed OFMT for multi-platform regression-testing (#988) 2022-03-16 14:44:42 -04:00
0014 Use fixed OFMT for multi-platform regression-testing (#988) 2022-03-16 14:44:42 -04:00
0015 Use fixed OFMT for multi-platform regression-testing (#988) 2022-03-16 14:44:42 -04:00
0016 Standardize Go-package structure (#746) 2021-11-11 14:15:13 -05:00
0017 Standardize Go-package structure (#746) 2021-11-11 14:15:13 -05:00
0018 Static-check fixes from @lespea #1657, batch 1/n (#1703) 2024-10-27 11:42:43 -04:00
0019 update null_count for use in stats1 2022-07-12 01:27:04 -04:00
0020 Add sliding-window mode to mlr stats1 via -w {n} (#1017) (#2186) 2026-07-14 10:24:41 -04:00
0021 Add sliding-window mode to mlr stats1 via -w {n} (#1017) (#2186) 2026-07-14 10:24:41 -04:00
0022 Add sliding-window mode to mlr stats1 via -w {n} (#1017) (#2186) 2026-07-14 10:24:41 -04:00
0023 Add sliding-window mode to mlr stats1 via -w {n} (#1017) (#2186) 2026-07-14 10:24:41 -04:00
0024 Add sliding-window mode to mlr stats1 via -w {n} (#1017) (#2186) 2026-07-14 10:24:41 -04:00
0025 Add sliding-window mode to mlr stats1 via -w {n} (#1017) (#2186) 2026-07-14 10:24:41 -04:00