Skip to content
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

How recent are "pipes" as a feature in R? #764

Closed
maneesha opened this issue Sep 19, 2021 · 7 comments
Closed

How recent are "pipes" as a feature in R? #764

maneesha opened this issue Sep 19, 2021 · 7 comments
Labels
good first issue Good issue for first-time contributors help wanted Looking for Contributors

Comments

@maneesha
Copy link
Contributor

In the Manipulating data episode it says pipes are a recent addition to R. It seems like pipes have been around since 2014. See this and this.

@Teebusch
Copy link
Contributor

Hi @maneesha , thank you for this comment. I agree that pipes have been around for long enough to not be "recent" anymore (although in my personal experience, some people who learned R long ago haven't gotten familiar with the tidyverse yet).

I think the intention of writing this may have been to point out that the pipe is not part of base R. Perhaps we can change it to something like that. How about writing something like "The pipe is a special operator that is part of the tidyverse"?

@Teebusch Teebusch added good first issue Good issue for first-time contributors help wanted Looking for Contributors labels Sep 23, 2021
@Lucy-Quirk
Copy link

I agree with @maneesha the intention was likely to let the learners know that pipes are not base R, although it is no longer recent. I would like to point out that pipes are also available through the dplyr package. I would suggest something like: "Pipes are a special operator that improves the readability of your code by condensing many commands into a few lines of functions. "

@kiblerchris
Copy link

It's worth noting that R version 4.1 introduced a new version of the pipe operator that is included in the base installation. It is conceptually similar to the pipe operator from {tidyverse}, but the syntax is a bit different. So now there are now two different versions of the pipe operator. This blog post compares the two versions.

I think that @maneesha is correct when she says that the {tidyverse} pipe operator is not a recent addition. In my experience, it is now ubiquitous in many coding communities. But the base pipe operator is a recent addition.

I don't think the lesson should utilize the base pipe operator until it gains some traction. But it is probably worth mentioning it in passing when the lesson is revised.

@mantoniou
Copy link

Originally, a pipe operator was introduced in 2014 in magrittr package, implemented as %>%, with which you may pipe a value forward into an expression or function call. It is used extensively with all tidyverse packages (dplyr, tidyr etc.). But since May 2021, under R version 4.1.0, a native R pipe operator has been introduced. It is implemented as |>, with similar behaviour to the original magrittr pipe operator. I think it is worth mentioning that the idea of the pipe, as far as I am aware, probably comes from UNIX/LINUX, where it is implemented as |

@ooyerind
Copy link

I did not have any clue about the new pipe (|>) until a couple of months ago. The new pipe is handy because it is very easy for my students to remember, as opposed to the older pipe (%>%) which is difficult for my students to remember.

@bisesi
Copy link

bisesi commented Feb 14, 2023

I agree it seems worth mentioning the base R pipe into the lesson as an alternative, while noting that there are a few differences between it and the magrittr pipe operator. For example, while the magrittr pipe can accept piped function calls without parentheses, the native pipe can't. Placeholding also works differently between the two. A lot of the details are unnecessary for this particular point in the lesson, but maybe linking a cheatsheet would allow people to identify which pipe might work best for them.

@tobyhodges
Copy link
Member

Thanks everyone for contributing to this discussion. The lesson underwent a major update and reorganisation when #887 was merged. As this issue relates to content in a version of the lesson before that update took place, I will close it. Please open a new issue if you believe that some or all of the changes being discussed here remain relevant to the redesigned lesson, linking to this thread where appropriate.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good issue for first-time contributors help wanted Looking for Contributors
Projects
None yet
Development

No branches or pull requests

8 participants