-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Native pipe does not work with rowwise #6965
Comments
I guess the problem is not the pipe, but the dot inside sum(.). The base R pipe needs a different syntax to work. |
It doesnt make sensethat these pipes will not work the same... I find this a bugrather than a feature. For my own purpose I already solved it (My use case was a bit more complex obviously), but it doesnt resonate with me that they would behave differently. |
I think you're wrong :) They are similar but intrinsically a little different. Read that please:
edit: the Stackoverflow answer added |
Here is a workaround for an identical result to your example
|
the workaround is to use the more robust pipe if you ask me ;) thanks though. I am not convinced that this is something worth keeping in the future (the differences) but sure. I'll adjust my defaults |
The base R pipe is deliberately different from the magrittr pipe. The differences are outlined in https://www.tidyverse.org/blog/2023/04/base-vs-magrittr-pipe/#-vs as @philibe mentioned, and there is nothing dplyr can do to support this differently |
Using the
dplyr::rowwise
i noticed something strange.The native R pipe (|>) Doesn't work, where's the
magrittr::%>%
works just fine.The following code works:
mtcars |> rowwise() %>% mutate(sum = sum(.))
But this one doesnt:
mtcars |> rowwise() |> mutate(sum = sum(.))
The text was updated successfully, but these errors were encountered: