R/fun2form.R

Defines functions fun2form

Documented in fun2form

fun2form <-
function(fun, y = NULL)
{
   if (!inherits(fun, "function"))
       stop("'fun' must be an object of class 'function'!")
   if (!is.null(y) & !inherits(y, "character"))
       stop("'y' must be a 'character' which is going to define the left side of the formula!")
   form <- as.formula(paste(y, "~", deparse(fun)[2]))
   return(form)
}

Try the soilphysics package in your browser

Any scripts or data that you put into this service are public.

soilphysics documentation built on June 7, 2022, 5:06 p.m.