valueOrFunction: If 'val' is a function, evaluate it, otherwise return 'val'

View source: R/HelperFunctions.R

valueOrFunctionR Documentation

If val is a function, evaluate it, otherwise return val

Description

If val is a function, evaluate it, otherwise return val

Usage

valueOrFunction(val, ...)

Arguments

val

Function or value

...

Argument passed to val if it is a function

Value

the value, potentially with the given function applied

Examples

valueOrFunction(3) # returns 3
valueOrFunction(`+`, 1, 2) # also returns 3
A = `+`
valueOrFunction(A, 1, 2)

LifeInsureR documentation built on June 15, 2025, 1:08 a.m.