[R-pkgs] gestalt: Tools for Making and Combining Functions
eh@ @ending from po@teo@de
Sat Jun 2 23:30:45 CEST 2018
Dear R Users,
The gestalt package (0.1.1) has been published on CRAN:
It provides a suite of function-building tools centered around a
(forward) composition operator, '%>>>%', which extends the semantics
of the magrittr '%>%' operator and supports tidyverse quasiquotation.
Aside from making your functions more modular, the main benefit of
'%>>>%' is its ability to make composite functions that can be
inspected and transformed as list-like objects.
As an illustration, you can sample, capitalize, and join (character)
vectors with the following composite function:
draw <- sample %>>>% toupper %>>>% paste(collapse = "")
#>  “GJNUE"
But because the composite function 'draw()' is list-like, you can also
inspect its intermediate results using a standard map-reduce strategy:
stepwise <- lapply(`%>>>%`, print) %>>>% compose
#>  "g" "j" "n" "u" "e"
#>  "G" "J" "N" "U" "E"
#>  "GJNUE"
In conjunction with '%>>>%', a compact function constructor, 'fn()',
and a function that performs partial application, 'partial()', are
also provided. Both support quasiquotation.
Learn more from
- the landing page of the source repository:
- the package vignette, which gives an overview through examples:
Bug reports and other feedback are welcome at the GitHub issues page:
More information about the R-packages