applyHook: If 'hook' is a function, apply it to 'val', otherwise return...

View source: R/HelperFunctions.R

applyHookR Documentation

If hook is a function, apply it to val, otherwise return val unchanged

Description

If hook is a function, apply it to val, otherwise return val unchanged

Usage

applyHook(hook, val, ...)

Arguments

hook

(optional) function to apply to val and the other parameters

val

The value to which the hook is applied (ifgiven)

...

optional parameters passed to the hook function (if it is a function)

Examples

applyHook(NULL, 3) # returns 3 unchanged
applyHook(function(x) 2*x, 3) # applies the function, returns 6
applyHook(`+`, 3, 1) # returns 4

kainhofer/r-life-insurance-contracts documentation built on Sept. 18, 2022, 7:56 p.m.