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

Native pipe vs dplyr/magrittr pipe #716

Open
sraorao opened this issue May 21, 2021 · 3 comments
Open

Native pipe vs dplyr/magrittr pipe #716

sraorao opened this issue May 21, 2021 · 3 comments
Labels
good first issue Good issue for first-time contributors help wanted Looking for Contributors type:enhancement Propose enhancement to the lesson

Comments

@sraorao
Copy link

sraorao commented May 21, 2021

From R v4.1.0, there is a pipe |> natively available in base R. Could this be a source of confusion when discussing the dplyr/magrittr pipe %>% here: http://swcarpentry.github.io/r-novice-gapminder/13-dplyr/index.html ? At present they seem to be different enough in important ways that they can't be used interchangeably.

@jcoliver
Copy link
Contributor

Thanks @sraorao . I do not think we need to immediately discuss the differences (although an Optional box acknowledging the native R pipe could be warranted). As the native pipe does not appear to be widely used (yet), restricting the discussion to magrittr's pipe seems fine for now. If |> becomes widely adopted, we will need to address it head-on.

@sraorao
Copy link
Author

sraorao commented May 23, 2021

Hi @jcoliver , yes that makes sense as it's still early days with the native pipe. An Optional box could be useful though.

@jcoliver jcoliver added good first issue Good issue for first-time contributors help wanted Looking for Contributors type:enhancement Propose enhancement to the lesson labels Sep 28, 2021
@mdozmorov
Copy link

There is an awesome summary of the new pipe operator, by Aedin Culhane @aedin Tweet. Would be ideal for a box-like summary.

|> or  %>%

help("|>") for help
|> no need to library magrittr or dplyr
|> may be quicker to type or easier to read 
|> requires () after functions df |> nrow()
|> do not accept . arguments after 1st

The latter looks like a limitation, so I keep using the good old %>%.

More details at Some of the updates and additions in R-4.1.0. And, more thorough notes when to use (and not to use) Pipes by Hadley Wickham @hadley, as well as the Should I avoid programming packages with pipe operators? SO discussion.

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 type:enhancement Propose enhancement to the lesson
Projects
None yet
Development

No branches or pull requests

3 participants