Software
Placeholder

slider

Sliding Window Functions

R

slider provides a family of general-purpose sliding window functions for R with an API similar to purrr. It computes rolling calculations like moving averages, cumulative sums, or rolling regressions by iterating over data with a sliding window that always returns output the same size as the input.

The package offers three core approaches: slide() for standard fixed-width windows, slide_index() for index-aware calculations relative to irregular time series (like computing 3-month rolling averages where months have different lengths), and slide_period() for sliding over time blocks. It includes optimized C implementations for common operations like slide_mean() and slide_sum() that are significantly faster than general-purpose equivalents. The package handles data frames in a row-wise fashion, making operations like rolling regressions straightforward.

Contributors