fun2form: Converting Function to Formula

Description Usage Arguments Value Warning Author(s) See Also Examples

View source: R/fun2form.R

Description

An accessorial function to convert an object of class 'function' to an object of class 'formula'.

Usage

1
 fun2form(fun, y = NULL) 

Arguments

fun

a object of class 'function'. It must be a one-line-written function, with no curly braces "{}".

y

optional; a character defining the lef side of the formula, y = fun().

Value

An object of class formula.

Warning

Numerical values into fun with three or more digits may cause miscalculation.

Author(s)

Anderson Rodrigo da Silva <[email protected]>

See Also

function, formula

Examples

1
2
3
4
5
6
7
8
9
g <- function(x) Asym * exp(-b2 * b3 ^ x) # Gompertz Growth Model
fun2form(g, "y")

# f1 <- function(w) {exp(w)} # error
# fun2form(f1, "x") 
f2 <- function(w) exp(w) # ok
fun2form(f2, "x")

# End (not run)

soilphysics documentation built on May 30, 2017, 2:49 a.m.