[Rd] [External] anonymous functions

Gabor Grothendieck ggrothend|eck @end|ng |rom gm@||@com
Tue Dec 8 16:32:04 CET 2020

On Mon, Dec 7, 2020 at 12:34 PM <luke-tierney using 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.

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

More information about the R-devel mailing list