From 708915f69070c7d65acf3a46cb6e0c02dffc6af9 Mon Sep 17 00:00:00 2001 From: Ken Williams Date: Wed, 13 Mar 2019 10:17:02 -0500 Subject: [PATCH] Search for baselearner in this package Search for `baselearner` in this package, not in the caller's namespace. When `baselearner` is given as a string, it's limited (by `match.arg`) to the pre-defined choices `c("bbs", "bols", "btree", "bss", "bns")`. It doesn't make sense to require the caller to import that symbol when we know it's defined in the `mboost` package anyway. --- R/mboost.R | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/R/mboost.R b/R/mboost.R index c8f74f6..c19365e 100644 --- a/R/mboost.R +++ b/R/mboost.R @@ -518,15 +518,11 @@ mboost <- function(formula, data = list(), na.action = na.omit, weights = NULL, if (is.character(baselearner)) { baselearner <- match.arg(baselearner) - bname <- baselearner if (baselearner %in% c("bss", "bns")) { warning("bss and bns are deprecated, bbs is used instead") baselearner <- "bbs" } - baselearner <- get(baselearner, mode = "function", - envir = parent.frame()) - } else { - bname <- deparse(substitute(baselearner)) + baselearner <- get(baselearner, mode = "function") } stopifnot(is.function(baselearner))