Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.
  • Loading branch information
kenahoo authored Mar 13, 2019
commit 708915f69070c7d65acf3a46cb6e0c02dffc6af9
6 changes: 1 addition & 5 deletions R/mboost.R
Original file line number Diff line number Diff line change
Expand Up @@ -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))

Expand Down