diff --git a/R-package/R/getinfo.xgb.DMatrix.R b/R-package/R/getinfo.xgb.DMatrix.R index 26523699a..dc734bce1 100644 --- a/R-package/R/getinfo.xgb.DMatrix.R +++ b/R-package/R/getinfo.xgb.DMatrix.R @@ -35,7 +35,7 @@ getinfo <- function(object, ...){ #' @param ... other parameters #' @rdname getinfo #' @method getinfo xgb.DMatrix -setMethod("getinfo", signature = "xgb.DMatrix", +setMethod("getinfo", signature = "xgb.DMatrix", definition = function(object, name) { if (typeof(name) != "character") { stop("xgb.getinfo: name must be character") @@ -43,7 +43,7 @@ setMethod("getinfo", signature = "xgb.DMatrix", if (class(object) != "xgb.DMatrix") { stop("xgb.setinfo: first argument dtrain must be xgb.DMatrix") } - if (name != "label" && name != "weight" && + if (name != "label" && name != "weight" && name != "base_margin" && name != "nrow") { stop(paste("xgb.getinfo: unknown info name", name)) } @@ -54,4 +54,3 @@ setMethod("getinfo", signature = "xgb.DMatrix", } return(ret) }) - diff --git a/R-package/R/predict.xgb.Booster.handle.R b/R-package/R/predict.xgb.Booster.handle.R index 685318f12..5788283da 100644 --- a/R-package/R/predict.xgb.Booster.handle.R +++ b/R-package/R/predict.xgb.Booster.handle.R @@ -5,14 +5,14 @@ #' @param object Object of class "xgb.Boost.handle" #' @param ... Parameters pass to \code{predict.xgb.Booster} #' -setMethod("predict", signature = "xgb.Booster.handle", +setMethod("predict", signature = "xgb.Booster.handle", definition = function(object, ...) { if (class(object) != "xgb.Booster.handle"){ stop("predict: model in prediction must be of class xgb.Booster.handle") } - + bst <- xgb.handleToBooster(object) - + ret = predict(bst, ...) return(ret) })