fx: Shortcut for creating functions of x

fxR Documentation

Shortcut for creating functions of x

Description

'fx(body)' is essentially equal to 'function(x) body'. This can be used to quickly create functions, with minimal syntactic burden.

Usage

fx(
  .body,
  template = function(x) {
 },
  .env = parent.frame()
)

Arguments

.body

the expression that will form the body of the function, it is not evaluated.

template

a template for the function, providing its formal parameters.

.env

the environment in which the body of the function is evaluated.

Value

a function with .body as body

Examples

f = fx(sin(x)+cos(x))
f
f(pi)



DistributionalDDA documentation built on Oct. 20, 2026, 5:06 p.m.