From toth@dene@ @end|ng |rom kogentum@hu  Fri Dec  4 16:05:45 2020
From: toth@dene@ @end|ng |rom kogentum@hu (=?UTF-8?B?RMOpbmVzIFTDs3Ro?=)
Date: Fri, 4 Dec 2020 16:05:45 +0100
Subject: [Rd] New pipe operator
In-Reply-To: <7586e034-e287-0970-6480-f82d747b5445@gmail.com>
References: <e55c2093-0bb5-5f9b-5521-0ca8bdf35953@gmail.com>
 <CALyqOb8c1hHOSaMV+fqXTwpeOsP--KJ_t-oeqMYYafVXeNpqZg@mail.gmail.com>
 <7586e034-e287-0970-6480-f82d747b5445@gmail.com>
Message-ID: <b98cf6d4-b856-2963-1882-9341384d141d@kogentum.hu>


On 12/4/20 3:05 PM, Duncan Murdoch wrote:
> ...
> 
> It's tempting to suggest it should allow something like
> 
>  ? mtcars |> subset(cyl == 4) |> lm(mpg ~ disp, data = .)
> 
> which would be expanded to something equivalent to the other versions: 
> but that makes it quite a bit more complicated.? (Maybe _ or \. should 
> be used instead of ., since those are not legal variable names.)

I support the idea of using an underscore (_) as the placeholder symbol. 
  Syntactic sugars work the the best if 1) they require less keystrokes 
and/or 2) are easier to read compared to the "normal" syntax, and 3) can 
not lead to unexpected bugs (which is a major problem with the magrittr 
pipe). Using '_' fulfills all of these criteria since '_' can not clash 
with any variable in the environment.

Denes



[Rd] New pipe operator
=?UTF-8?B?RMOpbmVzIFTDs3Ro?=