Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

fun2form

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

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

Soil Physical Analysis

v4.0
GPL (>= 2)
Authors
Anderson Rodrigo da Silva [aut, cre] (<https://orcid.org/0000-0003-2518-542X>), Renato Paiva de Lima [aut] (<https://orcid.org/0000-0003-0524-439X>)
Initial release
2020-12-06

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.