Re: [Rd] [External] anonymous functions

2020-12-08 Thread Duncan Murdoch
On 07/12/2020 12:26 p.m., luke-tier...@uiowa.edu wrote: I don't disagree in principle, but the reality is users want shortcuts and as a result various packages, in particular tidyverse, have been providing them. Mostly based on formulas, mostly with significant issues since formulas weren't desig

Re: [Rd] New pipe operator

2020-12-08 Thread Gabor Grothendieck
Duncan Murdoch: > I agree it's all about call expressions, but they aren't all being > treated equally: > > x |> f(...) > > expands to f(x, ...), while > > x |> `function`(...) > > expands to `function`(...)(x). This is an exception to the rule for Yes, this is the problem. It is trying to handl

Re: [Rd] New pipe operator

2020-12-08 Thread Hadley Wickham
I just wanted to pipe in here (HA HA) to say that I agree with Kevin. I've never loved the complicated magrittr rule (which has personally tripped me up a couple of times) and I think the compact inline function syntax provides a more general solution. It is a bit more typing, and it will require a

Re: [Rd] [External] anonymous functions

2020-12-08 Thread Duncan Murdoch
On 08/12/2020 6:21 a.m., Duncan Murdoch wrote: On 07/12/2020 12:26 p.m., luke-tier...@uiowa.edu wrote: I don't disagree in principle, but the reality is users want shortcuts and as a result various packages, in particular tidyverse, have been providing them. Mostly based on formulas, mostly with

Re: [Rd] [External] anonymous functions

2020-12-08 Thread Gabor Grothendieck
On Mon, Dec 7, 2020 at 12:34 PM wrote: > I don't disagree in principle, but the reality is users want shortcuts > and as a result various packages, in particular tidyverse, have been > providing them. Mostly based on formulas, mostly with significant > issues since formulas weren't designed for th

Re: [Rd] [External] Re: New pipe operator

2020-12-08 Thread Gabor Grothendieck
On Mon, Dec 7, 2020 at 9:09 AM Gabor Grothendieck wrote: > > On Sat, Dec 5, 2020 at 1:19 PM wrote: > > Let's get some experience > > Here is my last SO post using dplyr rewritten to use R 4.1 devel. Seems It occurred to me it would also be interesting to show this example rewritten using John M

Re: [Rd] New pipe operator

2020-12-08 Thread Bravington, Mark (Data61, Hobart)
> > On 06/12/2020 8:22 p.m., Bravington, Mark (Data61, Hobart) wrote: > (and Duncan Murdoch responded, as below) It still seems to me that placeholders are viable and unambiguous (only as things in RHS of pipes), and that something like x |> foo( _PIPE_) x |> bah( otherarg, _PIPE_) x |> { y <

Re: [Rd] New pipe operator

2020-12-08 Thread Duncan Murdoch
First, one comment: You're right about the illegality of _PIPE_ as a name, I had misremembered the rule. About your proposal: I don't find it attractive, but I can see that some people would. But I don't think it's necessary to put it into the base parser. Other than using an illegal n

[Rd] Ignore Sites Option For libPaths

2020-12-08 Thread Dario Strbenac
Good day, Could .libPaths gain an option to ignore all values other than the user-specified new parameter? Currently, it takes the union of new and .Library and .Library.site and there is no way to turn it off. For quick and convenient troubleshooting that doesn't involve requiring the editing

Re: [Rd] Ignore Sites Option For libPaths

2020-12-08 Thread Gabriel Becker
Hi Dario, My switchr package is designed specifically to do what you're describing, and does support excluding site libraries. So clearly I agree it would be useful, but also, it does go against the "concept" of site libraries somewhat. I agree it would be a useful addition with the default to in

Re: [Rd] Ignore Sites Option For libPaths

2020-12-08 Thread Dirk Eddelbuettel
On 8 December 2020 at 23:00, Dario Strbenac wrote: | Could .libPaths gain an option to ignore all values other than the user-specified new parameter? Currently, it takes the union of new and .Library and .Library.site and there is no way to turn it off. Are you use? It is constructed from loo

Re: [Rd] Ignore Sites Option For libPaths

2020-12-08 Thread Gabriel Becker
Of course you can, but the ability to do something via R code and the ability to do them by wrapping the invocation of R are not similar terms of convenience, IMO. I say that as someone who routinely does both type of thing. ~G On Tue, Dec 8, 2020 at 4:07 PM Dirk Eddelbuettel wrote: > > On 8 D

Re: [Rd] Ignore Sites Option For libPaths

2020-12-08 Thread Dario Strbenac
Good day, That seems like a straightforward and reasonable thing to do, but: ~$ R_LIBS="/tmp" R_LIBS_SITE="/var" Rscript -e 'print(.libPaths())' [1] "/dora/nobackup/biostat/Rpackages/v4" "/dora/users/course/splus/library/R" [3] "/usr/lib/R/site-library" "/usr/lib/R/library" /tmp and

Re: [Rd] Ignore Sites Option For libPaths

2020-12-08 Thread Dirk Eddelbuettel
On 9 December 2020 at 02:00, Dario Strbenac wrote: | That seems like a straightforward and reasonable thing to do, but: | | ~$ R_LIBS="/tmp" R_LIBS_SITE="/var" Rscript -e 'print(.libPaths())' | [1] "/dora/nobackup/biostat/Rpackages/v4" "/dora/users/course/splus/library/R" | [3] "/usr/lib/R/sit

Re: [Rd] New pipe operator

2020-12-08 Thread Bravington, Mark (Data61, Hobart)
> [Duncan Murdoch responding to...] > [... Mark Bravington's proposals for placeholders and anonymous functions] > > x |> foo( _PIPE_) # placeholder > > x |> bah( otherarg, _PIPE_)# placeholder > > x |> { y <- _PIPE_+1; _PIPE_ / y } # anonymous function > [DM] About your p