我正在尝试使用 R 包 mlr 的第一个示例,可以在此处找到。但我收到以下错误消息:
> lrn = makeLearner("classif.lda")
Error in substr(packs, 1L + (force.load | force.attach), nchar(packs)) :
4 arguments passed to .Internal(nchar) which requires 3
会话信息提供以下输出:
> sessionInfo()
R version 3.2.0 (2015-04-16)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 8 x64 (build 9200)
locale:
[1] LC_COLLATE=German_Germany.1252 LC_CTYPE=German_Germany.1252
[3] LC_MONETARY=German_Germany.1252 LC_NUMERIC=C
[5] LC_TIME=German_Germany.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] mlr_2.8 ParamHelpers_1.7 ggplot2_1.0.1 BBmisc_1.9
loaded via a namespace (and not attached):
[1] Rcpp_0.11.5 magrittr_1.5 splines_3.2.0 MASS_7.3-40
[5] munsell_0.4.2 xtable_1.8-0 colorspace_1.2-6 R6_2.0.1
[9] dplyr_0.4.1 stringr_1.0.0 plyr_1.8.2 tools_3.2.0
[13] parallel_3.2.0 grid_3.2.0 checkmate_1.7.4 gtable_0.1.2
[17] DBI_0.3.1 ggvis_0.4.2 htmltools_0.2.6 survival_2.38-1
[21] assertthat_0.1 leaflet_1.0.0 digest_0.6.8 shiny_0.12.2
[25] reshape2_1.4.1 htmlwidgets_0.5 mime_0.4 parallelMap_1.3
[29] stringi_0.4-1 scales_0.3.0 backports_1.0.2 httpuv_1.3.3
[33] proto_0.3-10
这是 traceback() 的输出:
> lrn = makeLearner("classif.lda")
Error in substr(packs, 1L + (force.load | force.attach), nchar(packs)) :
4 arguments passed to .Internal(nchar) which requires 3
> traceback()
8: substr(packs, 1L + (force.load | force.attach), nchar(packs))
7: requirePackages(package, why = paste("learner", id), default.method = "load")
6: makeRLearnerInternal(cl, "classif", package, par.set, par.vals,
properties, name, short.name, note)
5: addClasses(makeRLearnerInternal(cl, "classif", package, par.set,
par.vals, properties, name, short.name, note), c(cl, "RLearnerClassif"))
4: makeRLearnerClassif(cl = "classif.lda", package = "MASS", par.set = makeParamSet(makeDiscreteLearnerParam(id = "method",
default = "moment", values = c("moment", "mle", "mve", "t")),
makeNumericLearnerParam(id = "nu", lower = 2, requires = quote(method ==
"t")), makeNumericLearnerParam(id = "tol", default = 1e-04,
lower = 0), makeDiscreteLearnerParam(id = "predict.method",
values = c("plug-in", "predictive", "debiased"), default = "plug-in",
when = "predict"), makeLogicalLearnerParam(id = "CV",
default = FALSE, tunable = FALSE)), properties = c("twoclass",
"multiclass", "numerics", "factors", "prob"), name = "Linear Discriminant Analysis",
short.name = "lda", note = "Learner parameter `predict.method` maps to `method` in `predict.lda`.")
3: (function ()
{
makeRLearnerClassif(cl = "classif.lda", package = "MASS",
par.set = makeParamSet(makeDiscreteLearnerParam(id = "method",
default = "moment", values = c("moment", "mle", "mve",
"t")), makeNumericLearnerParam(id = "nu", lower = 2,
requires = quote(method == "t")), makeNumericLearnerParam(id = "tol",
default = 1e-04, lower = 0), makeDiscreteLearnerParam(id = "predict.method",
values = c("plug-in", "predictive", "debiased"),
default = "plug-in", when = "predict"), makeLogicalLearnerParam(id = "CV",
default = FALSE, tunable = FALSE)), properties = c("twoclass",
"multiclass", "numerics", "factors", "prob"), name = "Linear Discriminant Analysis",
short.name = "lda", note = "Learner parameter `predict.method` maps to `method` in `predict.lda`.")
})()
2: do.call(constructor, list())
1: makeLearner("classif.lda")
知道为什么会发生此错误(我使用的是 R 版本 3.2.0)吗?