Open iangow opened 2 months ago
I think if this was going to be considered then it would only be an argument to the dbplyr data frame method, so I'm going to move it there and let them decide. I don't think it is super useful for the general case because we already have other means of doing windowed evaluations per column, like with {slider}.
Yeah, this syntax looks pretty reasonable to me now.
Back in 2017, @Hadley suggested "there are two possible APIs" for implementing what became
window_frame()
andwindow_order()
(see tidyverse/dplyr#2874; @edgararuiz-zz).At the time, I believe there was no
.by
argument tomutate()
, so thewindow_frame()
/window_order()
approach seemed to make most sense. At that time one choice was:But now this could be something like:
This would seem to have the merit of making it easier for
dbplyr
to infer that a window function was being sought (currently there are cases wheredbplyr
does not get the hint).I am surprised that I have only one instance of
window_frame()
in my book. It seems like a very handy pattern (e.g., moving averages, windowed regressions).I had a comical exchange with ChatGPT about this this afternoon (Australia time) (see here).