rolling#
- swordfish.function.rolling()#
The rolling function applies func to a moving window of funcArgs. It starts calculating when the window size is reached for the first time, then calculates with frequency specified by step.
Similar to the moving function, windows in rolling function are always along rows.
The differences of rolling and moving functions lie in:
The func parameter in rolling function supports aggregate or vectorized functions, whereas func in moving function only supports aggregate functions.
When func is specified as an aggregate function,
step can be specified in rolling function.
rolling does not return null values of the first (window -1) elements.
- Parameters:
func (Constant) – An aggregate or vectorized function.
funcArgs (Constant) – The arguments passed to func, which can be vectors, matrices, or tables. It is a tuple if there are more than 1 parameter of func, and all arguments must have the same size (the number of elements of a vector or rows of a matrix).
window (Constant) – The window size.
step (Constant, optional) – The count or interval that windows slide. The default value is 1. If func is a vectorized function, step must be equal to window.