r-lib / slider

Sliding Window Functions
https://slider.r-lib.org
Other
295 stars 12 forks source link

slide_median? #203

Open nikostr opened 2 months ago

nikostr commented 2 months ago

Thanks for this excellent package! Using slide_mean is very fast, slide_dbl(x, median) is a lot slower. Would it be possible to implement a slide_median function?

DavisVaughan commented 2 months ago

A rolling median is computationally much different from a rolling mean and doesn't fit particularly well with the fast implementation that backs slide_mean/all/any/etc. I looked into it awhile back when I was implementing those, and while it is possible, it would be a lot of work and I doubt I'll have time for that in the short to medium term