_site/R/get-input-vars-from-model.R

GetInputVarsFromModel <- function(model) UseMethod("GetInputVarsFromModel")

GetInputVarsFromModel.lm <- function(model) {
  # This seems like a robust way to get the input names from an lm object, but I'm not really sure
  return(attr(model$terms, "term.labels"))
}

GetInputVarsFromModel.glm <- function(model) {
  # This seems like a robust way to get the input names from an glm object, but I'm not really sure
  return(attr(model$terms, "term.labels"))
}

GetInputVarsFromModel.randomForest <- function(model) {
  # This seems like a robust way to get the input names from an glm object, but I'm not really sure
  return(attr(model$terms, "term.labels"))
}
dchudz/predcomps documentation built on May 15, 2019, 1:48 a.m.