diff --git a/R-package/R/utils.R b/R-package/R/utils.R index 7336ed213..b0a86e2b6 100644 --- a/R-package/R/utils.R +++ b/R-package/R/utils.R @@ -36,8 +36,8 @@ xgb.setinfo <- function(dmat, name, info) { 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") + if (sum(info)!=xgb.numrow(dmat)) + stop("The sum 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)