From a146f0c5e1166bf1857238c76074768c4bd840ab Mon Sep 17 00:00:00 2001 From: Tong He Date: Mon, 16 Mar 2015 23:23:22 -0700 Subject: [PATCH] Update utils.R --- R-package/R/utils.R | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/R-package/R/utils.R b/R-package/R/utils.R index db46f83bb..ba3123a21 100644 --- a/R-package/R/utils.R +++ b/R-package/R/utils.R @@ -29,11 +29,15 @@ xgb.setinfo <- function(dmat, name, info) { return(TRUE) } if (name == "base_margin") { + if (length(info)!=xgb.numrow(dmat)) + stop("The length of base margin must equal to the number of rows in the input data") .Call("XGDMatrixSetInfo_R", dmat, name, as.numeric(info), PACKAGE = "xgboost") return(TRUE) } if (name == "group") { + if (length(info)!=xgb.numrow(dmat)) + stop("The length of groups must equal to the number of rows in the input data") .Call("XGDMatrixSetInfo_R", dmat, name, as.integer(info), PACKAGE = "xgboost") return(TRUE)