[Rd] [External] brief update on the pipe operator in R-devel
Iñaki Ucar
|uc@r @end|ng |rom |edor@project@org
Tue Jan 12 20:38:38 CET 2021
On Tue, 12 Jan 2021 at 20:23, <luke-tierney using uiowa.edu> wrote:
>
> After some discussions we've settled on a syntax of the form
>
> mtcars |> subset(cyl == 4) |> d => lm(mpg ~ disp, data = d)
>
> to handle cases where the pipe lhs needs to be passed to an argument
> other than the first of the function called on the rhs. This seems a
> to be a reasonable balance between making these non-standard cases
> easy to see but still easy to write. This is now committed to R-devel.
Interesting. Is the use of "d =>" restricted to pipelines? In other
words, I think that it shouldn't be equivalent to "function(d)", i.e.,
that this:
x <- d => lm(mpg ~ disp, data = d)
shouldn't work.
--
Iñaki Úcar
More information about the R-devel
mailing list