Skip to content
Prev 59244 / 63424 Next

New pipe operator and gg plotz

Thanks, Duncan. That answers my question fairly definitively.

Although it can be DONE it likely won't be for the reasons Hadley mentioned until we get some other product that replaces it entirely. There are some interesting work-arounds mentioned. 

I was thinking of one that has overhead but might be a pain. Hadley mentioned a slight variant. The first argument to a function now is expected to be the data argument. The second might be the mapping. Now if the function is called with a new first argument that is a ggplot object, it could be possible to test the type and if it is a ggplot object than slide over carefully any additional matched arguments that were not explicitly named. Not sure that is at all easy to do.

Alternately, you can ask that when used in such a pipeline that the user call all other arguments using names like data=whatever, mapping=aes(whatever) so no other args need to be adjusted by position.

But all this is academic and I concede will likely not be done. I can live with the plus signs.


-----Original Message-----
From: Duncan Murdoch <murdoch.duncan at gmail.com> 
Sent: Sunday, December 6, 2020 2:50 PM
To: Avi Gross <avigross at verizon.net>; 'r-devel' <r-devel at r-project.org>
Subject: Re: [Rd] New pipe operator and gg plotz

Hadley's answer (#7 here: 
https://community.rstudio.com/t/why-cant-ggplot2-use/4372) makes it pretty clear that he thinks it would have been nice now if he had made that choice when ggplot2 came out, but it's not worth the effort now to change it.

Duncan Murdoch
On 06/12/2020 2:34 p.m., Avi Gross via R-devel wrote: