From ggrothend|eck @end|ng |rom gm@||@com  Tue Dec  8 16:32:04 2020
From: ggrothend|eck @end|ng |rom gm@||@com (Gabor Grothendieck)
Date: Tue, 8 Dec 2020 10:32:04 -0500
Subject: [Rd] [External] anonymous functions
In-Reply-To: <alpine.DEB.2.21.2012071119120.3377@luke-Latitude-7480>
References: <28fddd$f2ifur@ironport10.mayo.edu>
 <alpine.DEB.2.21.2012071119120.3377@luke-Latitude-7480>
Message-ID: <CAP01uRktvLhnUWRtTe97MRx1UCYEvwRDyGDLVzGkLq55hXZg-w@mail.gmail.com>

On Mon, Dec 7, 2020 at 12:34 PM <luke-tierney at 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 designed for this, and mostly
> incompatible (tidyverse ones are compatible within tidyverse but not
> with others). And of course none work in sapply or lapply.

The formulas as functions in the gsubfn package work with nearly any function
including sapply and lapply.

  library(gsubfn)
  fn$lapply(1:3, ~ x + 1)
  ## [1] 2 3 4



[Rd] [External] anonymous functions
Gabor Grothendieck