From c16e0f6809a61e991b9f6678740c48481c35fc98 Mon Sep 17 00:00:00 2001 From: Tong He Date: Thu, 20 Nov 2014 15:19:53 -0800 Subject: [PATCH] Update predict.xgb.Booster.R add parameter missing --- R-package/R/predict.xgb.Booster.R | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/R-package/R/predict.xgb.Booster.R b/R-package/R/predict.xgb.Booster.R index 4758863ee..d57017b65 100644 --- a/R-package/R/predict.xgb.Booster.R +++ b/R-package/R/predict.xgb.Booster.R @@ -25,9 +25,13 @@ setClass("xgb.Booster") #' @export #' setMethod("predict", signature = "xgb.Booster", - definition = function(object, newdata, outputmargin = FALSE, ntreelimit = NULL) { + definition = function(object, newdata, missing = NULL, outputmargin = FALSE, ntreelimit = NULL) { if (class(newdata) != "xgb.DMatrix") { - newdata <- xgb.DMatrix(newdata) + if (is.null(missing)) { + newdata <- xgb.DMatrix(newdata) + } else { + newdata <- xgb.DMatrix(newdata, missing = missing) + } } if (is.null(ntreelimit)) { ntreelimit <- 0