Rolling Median¶
Computes the rolling median over a numeric vector using an ordered multiset with a tracked median iterator. Time complexity: O(log n) per element.
Usage¶
rolling_median(x, window_size, min_periods = window_size)
Parameters¶
Parameter |
Description |
|---|---|
|
A numeric vector of type double. |
|
Positive integer window length. |
|
Minimum number of non- |
Returns¶
A numeric vector with rolling median values.
Examples¶
x <- as.double(c(1, 3, 2, 5, 4))
rolling_median(x, 3L)