fun2form: Converting Function to Formula

View source: R/fun2form.R

fun2formR Documentation

Converting Function to Formula

Description

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

Usage

 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 <anderson.agro@hotmail.com>

See Also

function, formula

Examples

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 June 7, 2022, 5:06 p.m.