[R] Error out on multidimensional arrays (#9852)

This commit is contained in:
david-cortes
2023-12-06 10:43:51 +01:00
committed by GitHub
parent 62571b79eb
commit 0716c64ef7
2 changed files with 11 additions and 0 deletions

View File

@@ -297,3 +297,11 @@ test_that("xgb.DMatrix: Inf as missing", {
file.remove("inf.dmatrix")
file.remove("nan.dmatrix")
})
test_that("xgb.DMatrix: error on three-dimensional array", {
set.seed(123)
x <- matrix(rnorm(500), nrow = 50)
y <- rnorm(400)
dim(y) <- c(50, 4, 2)
expect_error(xgb.DMatrix(data = x, label = y))
})