R/object_model.R

Defines functions object_model add_model add_model.object_model mean.object_model sample.object_model var.object_model

Documented in object_model

#' object_model
#'
#' Wrapper class that contains all of the models for object attributes.
object_model <- function() {
  return(
    structure(
      list(
        models = list()
      ),
      class = "object_model"
    )
  )
}

add_model <- function(obj, name, model)
{
  UseMethod("add_model", obj)
}

add_model.object_model <- function(obj_model, name, model) {
  obj_model$models[[name]] <- model
  return(obj_model)
}

mean.object_model <- function(obj_model) {
  return(lapply(obj_model$models, mean))
}

sample.object_model <- function(obj_model) {
  return(lapply(obj_model$models, sample))
}

var.object_model <- function(obj_model) {
  return(lapply(obj_model$models, var))
}
fortunar/input_uncertainty_model documentation built on May 30, 2019, 6:26 a.m.