function.substitute: Substitute Parameters with Values

Description Usage Arguments Examples

Description

Create a copy of a given function where a set of parameters are replaced with values.

Usage

1
function.substitute(f, substitutes)

Arguments

f

the function

substitutes

the arguments to be substituted into the function.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
f <- function(x, pars) pars[1] + pars[2]*(x + pars[3]*x)
f
# function(x, pars) pars[1] + pars[2]*(x + pars[3]*x)
 g <- function.substitute(f, list("pars"=c(1, 2, 3)))
 g
# function (x)
#  1 + 2 * (x + 3 * x)
h <- function.substitute(f, list("pars"=c(1, 2, 3), "x"=4))
# function ()
# 33

thomasWeise/functionComposeR documentation built on May 28, 2019, 4:03 p.m.