-
Notifications
You must be signed in to change notification settings - Fork 47
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
Potentially misleading characterisation of R for Data Science's pipes chapter. #27
Comments
I don't want to open a new issue and it kinda fits here. It would be great to see how the author now values the new, native base R pipe. If it's a bad idea to use pipes from a programing perspective, why did the R Core team decide to copy-paste the idea? |
@z3tt It's been a while since I read the article and frankly don't want to re-read it right now. However, I didn't come away with the impression that he was attacking the use of pipes per se... |
@BroVic I know Norm is not a fan of the pipe, I was just curious if this holds for the new base R pipe as well. There is a statement that says that the pipe actually makes it harder to read code by adding "extra complexity" and that one can write unnested code anyway by running each step in isolation and assigning the output to an intermediate variable (https://github.com/matloff/TidyverseSkeptic). Frankly said, if this is an option for the author fine but I largely disagree that this makes it easier to read the code in comparison to a piped version of the same. I do think it is about pipes per se because this statement also holds for the new Anyway, just found a short note by Norm about the new pipe and, as it reads, R Core just added the "base pipe" as a friendly gesture for Rstudio (which I am highly sceptic of but well...):
Source: https://github.com/matloff/R-vs.-Python-for-Data-Science |
@z3tt friendly gesture? I find that amusing. The native pipe was implemented as an improvement--ugly syntax aside. I also don't agree with that assessment 🙂 |
@z3tt BTW I absolutely love your ggplot2 tutorial. Thank you! |
The native pipe was developed for base-R as an olive branch to RStudio., not because R Core thought it filled a need. I don't use either kind of R pipes. I do use Unix shell pipes a lot; see my comments on another Issue posted for this package. |
In the Pipes section, you claim "There are so many variations to learn that Hadley's R for Data Science book devotes a full chapter to pipes, 3415 words". This suggests that most of Hadley's time in that chapter is spent discussing the variations of the
%>%
pipe. I find this misleading. Opening that chapter, at least the online version, shows that most of it is spent discussing alternatives to pipes. Only one section is devoted to pipes other than the%>%
pipe. By my count, this section is not even 300 words in length. To wit, the%>%
pipe is originally described in chapter 5 and complexities like how a.
can be piped to are not covered at all (the Tidyverse functions try their best to put the data argument first, so you rarely need.
).I know of no source that spends any great amount of words explaining the variations of the magrittr pipes. There are only four pipes in the entire library. Once you understand
%>%
, both%T>%
and%<>%
are trivial. Look no further than how short their documentation is. I'd argue that only%$%
is complex, but it's easily understood after seeing a few examples.The text was updated successfully, but these errors were encountered: