Skip to contents

A wrapper should have the function signature, function(cmd, args, ..., .name = NULL) where ... may, optionally, be replaced with named parameters and their default values.

Usage

wrapped_factory(name, wrapper, ...)

Arguments

name

the function name, a string

wrapper

the wrapper, a function

...

(named) parameters in the execution stack; i.e., private to the wrapper

Details

When the code is invoked as a wrapped function, the function signature will be changed to match the wrapped function. cmd will be substituted with the wrapped function and args will be substituted with a list. That list has the form apple = apple, banana = banana, etc. In particular, the right hand side of each list element is a symbol and will need to be mapped into a value. One way to accomplish this is to include a do.call(cmd, args) line in the wrapper code.