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

Remove %>% in favor of |>? #562

Closed
billdenney opened this issue Dec 7, 2023 · 5 comments
Closed

Remove %>% in favor of |>? #562

billdenney opened this issue Dec 7, 2023 · 5 comments

Comments

@billdenney
Copy link
Collaborator

We currently export %>%.

The built-in |> was added in R 4.1 (about 2 years ago). I think that it would make sense to remove the magrittr pipe in favor of the built-in pipe throughout the package.

@sfirke
Copy link
Owner

sfirke commented Jan 25, 2024

I was just thinking this myself as I reviewed #559 . I agree it's reasonable to stop using %>% in the code and to stop exporting it.

@olivroy
Copy link
Contributor

olivroy commented Jan 25, 2024

The only thing is that the tidyverse has the policy of supporting the last 5 versions of R. I know that Hmisc depending on R 4.1 for this exact workflow broke CI for packages like ggplot2 on R 4.0 for example.

I know that purrr uses |> in examples. tidyverse/purrr#938 and has a hack for avoiding builds to work on 4.0 and 3.6.

I think it would be a good idea to stop re-exporting it as a first step? That would be a breaking change technically, but I am not sure many people rely on janitor to get the magrittr pipe in the first place.

@sfirke
Copy link
Owner

sfirke commented Jan 25, 2024

The stop re-exporting it seems like a good first step, it would be the breaking part for users. We should bump the janitor version number to indicate that. I think the next release could be 3.0.

@olivroy
Copy link
Contributor

olivroy commented Jan 30, 2024

If the pipe is not re-exported, the examples using %>% will not work without an explicit library(magrittr) call. I may look into implementing the workaround used in tidyverse packages https://fosstodon.org/@gaborcsardi/111821576530612948

@billdenney
Copy link
Collaborator Author

Thanks for looking that up.

To me, that seems like a lot of effort for a relatively small gain. When R 4.0 is very old (for some now-uncertain definition of "very"), I think that we should switch to |> when the effort is near-zero.

I will close this for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants