-
Notifications
You must be signed in to change notification settings - Fork 105
Closed
Labels
Description
Hello, I'm working on a PR to address #765. While doing so I ran into an issue with will_make_matrix(). Shouldn't the return value be True if y is a matrix or a vector?
When y is a numeric matrix it fails this check and converts it to a vector. This is stripping the colname of y whenever it is passed to function later down the line such as xgb_train()
Lines 326 to 336 in f081091
| will_make_matrix <- function(y) { | |
| if (is.matrix(y) | is.vector(y)) | |
| return(FALSE) | |
| cls <- unique(unlist(lapply(y, class))) | |
| if (length(cls) > 1) | |
| return(FALSE) | |
| can_convert <- | |
| vapply(y, function(x) | |
| is.atomic(x) & !is.factor(x), logical(1)) | |
| all(can_convert) | |
| } |