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.
This commit is contained in:
Baltazar Bieniek 2016-07-29 19:07:09 +02:00 committed by Tianqi Chen
parent a8adf16228
commit 89c4f67f59

View File

@ -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")
}