Skip to content

Commit 9d0ea59

Browse files
committed
avoid calling C5 functions to remove from Suggests
1 parent 32b4aff commit 9d0ea59

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

DESCRIPTION

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ Suggests:
3535
rmarkdown,
3636
survival,
3737
keras,
38-
C50,
3938
xgboost,
4039
covr
4140

R/boost_tree.R

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -437,17 +437,21 @@ C5.0_train <-
437437
other_args <- list(...)
438438
protect_ctrl <- c("minCases", "sample")
439439
protect_fit <- "trials"
440+
f_names <- names(formals(getFromNamespace("C5.0.default", "C50")))
441+
c_names <- names(formals(getFromNamespace("C5.0Control", "C50")))
440442
other_args <- other_args[!(other_args %in% c(protect_ctrl, protect_fit))]
441-
ctrl_args <- other_args[names(other_args) %in% names(formals(C50::C5.0Control))]
442-
fit_args <- other_args[names(other_args) %in% names(formals(C50::C5.0.default))]
443+
ctrl_args <- other_args[names(other_args) %in% c_names]
444+
fit_args <- other_args[names(other_args) %in% f_names]
443445

444-
ctrl <- expr(C50::C5.0Control())
446+
ctrl <- call2("C5.0Control", .ns = "C50")
445447
ctrl$minCases <- minCases
446448
ctrl$sample <- sample
447449
for(i in names(ctrl_args))
448450
ctrl[[i]] <- ctrl_args[[i]]
449451

450-
fit_call <- expr(C50::C5.0(x = x, y = y))
452+
fit_call <- call2("C5.0", .ns = "C50")
453+
fit_call$x <- expr(x)
454+
fit_call$y <- expr(y)
451455
fit_call$trials <- trials
452456
fit_call$control <- ctrl
453457
if(!is.null(weights))

0 commit comments

Comments
 (0)