R/format.bagEarth.R

format.bagEarth <- function(x, file = "", cat = TRUE, ...) 
{
  library(earth)

  eachEq <- lapply(
                   x$fit,
                   function(u, ...) format(u, ...),
                   ...)
  allEq <- paste(
                 "(",
                 paste(eachEq, collapse = "+"),
                 ") /",
                 x$B,
                 "\n")
  
  if(cat) cat(allEq, file = file) else return(allEq)  
}

Try the caret package in your browser

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

caret documentation built on May 2, 2019, 5:47 p.m.