R/model.r

#' Pass modelling information to ensemble()
#'
#' model collects the arguments needed to perform a method of regression. model is
#' intended to be used in conjunction with \code{\link{ensemble}} to create ensemble 
#' objects. model does not collect the name of the data set to be used.
#'
#' @param formula A formula object to be used in the intended model
#' @param FUN a character string that identifies the type of modelling method to be used. FUN should match the name of a modelling function in R
#' @param ... other arguments to pass to the modelling function indicated by type
#'
#' @keywords internal
#' @export 
model <- function(formula, FUN = "lm", ...) {
	structure(
		list(
			FUN = FUN,
			formula = formula,
			args = list(...)
		),
		class = c("mg_model", "list")
	)
}

#' is an object of class mg_model?
#' 
#' @param x an object 
#' @return A logical. TRUE is x inherits from calss mg_model. FALSE otherwise.
#' @keywords internal
#' @export
is.model <- function(x) inherits(x, "mg_model")
garrettgman/modelglyphs documentation built on May 16, 2019, 5:39 p.m.