Fresh out of the #RStats oven: It is now (= R-devel to become R 4.2.0) possible to use underscore (_) as a placeholder on the right-hand side (RHS) of a forward pipe, e.g. mtcars |> subset(cyl == 4) |> lm(mpg ~ disp, data = _) github.com/wch/r-source/comm…
#RStats community, really? It's been like 5 hours now and no one noticed the big news? 😛 github.com/wch/r-source/comm… Thank you @LukeTierney4 @_lionelhenry @jimhester_ (who else?) #pipypipy
14
86
26
319
Nice indeed. But then lm(mpg ~ disp, data = mtcars, subset = cyl==4) is still shorter, and quite possibly more readable. 😉 #rstats

Mar 8, 2022 · 9:26 PM UTC

3
1
19
...and if you want to pipe, then I would name the formula argument, avoiding to use the data argument: mtcars |> subset(cyl == 4) |> lm(formula = mpg ~ disp)
2
1
13
Which has the added advantage of already working today with the released version of #RStats 😀
1
1
5
I think typing the name of the arg everywhere in a code is overkill since there are many functions where the piped obj is not going to the first arg. lm, Map, Reduce, grep and co, do.call, etc.