From 89c4f67f59042b6043a4fa2aa0344d51d186605c Mon Sep 17 00:00:00 2001 From: Baltazar Bieniek Date: Fri, 29 Jul 2016 19:07:09 +0200 Subject: [PATCH] Class function returns more than one value (#1417) Fix to a bug when the class function returns more than one value. In that case, the code will fail. --- R-package/R/xgb.DMatrix.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R-package/R/xgb.DMatrix.R b/R-package/R/xgb.DMatrix.R index f6eeb041d..a6420d5ff 100644 --- a/R-package/R/xgb.DMatrix.R +++ b/R-package/R/xgb.DMatrix.R @@ -54,7 +54,7 @@ xgb.DMatrix <- function(data, info = list(), missing = NA, ...) { # internal helper method xgb.get.DMatrix <- function(data, label = NULL, missing = NA, weight = NULL) { inClass <- class(data) - if (inClass == "dgCMatrix" || inClass == "matrix") { + if ("dgCMatrix" %in% inClass || "matrix" %in% inClass ) { if (is.null(label)) { stop("xgboost: need label when data is a matrix") }