Learn R Programming

LifeInsureR (version 1.0.0)

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

Description

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

Usage

valueOrFunction(val, ...)

Value

the value, potentially with the given function applied

Arguments

val

Function or value

...

Argument passed to val if it is a function

Examples

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

Run the code above in your browser using DataLab