vadr (version 0.01)

with_arg: Inject named arguments into several calls and evaluate those calls.

Description

For a simple example, writing with_args(a="repeated argument", func(b=2), func(c=3), .collect=list)

Usage

with_arg(...)

Arguments

...
Named arguments are interpreted as arguments to inject. Unnamed arguments are interpreted as calls to evaluate.
.collect
Which function to use to collect the results of all the subcalls. Default is `list'.

Value

The results of the evaluated calls, collected using .collect.

Details

is equivalent to writing

list(fun(a="repeated argument",b=2), func(a="repeated argument",c=3))

so that with_args handles the job of distributing the repeated 'a' argument. This can save some typing in some situations, like heavily layered ggplot constructions.