-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cumsum function in mutate does not return values as expected on grouped dataframe #105
Comments
I think this is an auto-vectorization issue. Can you try adding a tilde in front of df2 = @chain df begin
@group_by(grp)
@mutate(x_cumsum = ~cumsum(x))
@ungroup
end If that works, I can update the code to remove the need for a tilde. Let me know. Thanks for reporting! |
I can confirm that adding the tilde in front of the |
Great, we'll get this fixed soon so that it will work both with and without the tilde. What's happening is that I'll add it to that list of exclusions, and in the longer term, the plan is to make that list modifiable by end-users so they can register other functions that they don't want to see auto-vectorized by Tidier in their workflow. |
This is now fixed on the GitHub version of Tidier. |
I am looking to implement a cumulative sum over a column, by group. I am using the following Tidier.jl code, but it does not return what I expect.
Returns a dataframe that looks like this (apologies for horrid formatting)
Row │ grp t x x_cumsum
│ String Int64 Int64 Array…
───┼────────────────────────────────
1 │ one 1 4 fill(4)
2 │ one 2 5 fill(5)
3 │ one 3 6 fill(6)
4 │ two 1 8 fill(8)
5 │ two 2 1 fill(1)
6 │ two 3 2 fill(2)
The text was updated successfully, but these errors were encountered: