You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It looks like the indexing is off by one for dplyr_cummean in /src/funs.cpp, causing the first index to be repeated twice (and the last index to be dropped). I'll submit a pull request with a slight change which I think makes it work as intended.
* Update indexing for dplyr_cummean (#5287)
* Add unit test for cummean
Check that cummean is consistent with the alternate method of
cummean(x) = cumsum(x) / seq_along(x).
Make sure future changes don't break the relationship above.
See also: #5287
* Update unit test for cummean
Add inline comments with exact values we expect to see,
so in the future it is easier to compare expected vs actual results.
* Update unit test for cummean
Add another check that we get expected values, independent of
cumsum and seq_along (in case of other bugs). That is,
cummean(1:5) = [1, 1.5, 2, 2.5, 3].
* Not assuming there is at least one element, +test
* + NEWS
Co-authored-by: Romain Francois <romain@rstudio.com>
For testing, I have this small vector
x
where the long(er) way is giving me the results as expected version 1.0.0cummean()
is not.Created on 2020-05-31 by the reprex package (v0.3.0)
The text was updated successfully, but these errors were encountered: