callWith: Call a Function with Given Arguments

View source: R/mergeArgs.R

callWithR Documentation

Call a Function with Given Arguments

Description

Call a function with the given arguments. Unnamed arguments are expected to be lists containing further argument assignments. Multiple argument lists are merged using arglist in the order of their appearence.

Usage

callWith(FUN, ...)

Arguments

FUN

function to be called

...

(unnamed) lists containing argument assignments passed to FUN or (named) arguments passed to FUN

Value

the return value is the return value of the function FUN.

See Also

arglist

Examples

# define some default arguments
args.default <- list(xlim = c(0, 10), ylim = c(0, 10), col = "red", lwd = 2)

# call plot with the default arguments
callWith(plot, x = 1:10, args.default)

# call plot with the default arguments but override the colour
callWith(plot, x = 1:10, args.default, col = "blue")


KWB-R/kwb.utils documentation built on April 1, 2024, 7:12 a.m.