In the gbm.fit function i got thrown the error "Error in if (nrow(x) != ifelse(class(y) == "Surv", nrow(y), length(y))) { : the condition has length > 1"
I think this is because the condition inside the if statement is not a single logical value, but rather a vector of logical values.
This error is likely to occur if the class() function is being applied to the y vector or matrix, and the result is a character vector with more than one element. For example, if y is a matrix with multiple columns, and each column has a different class, then the class() function will return a character vector with one element for each column in y. In this case, the ifelse() function would return a logical vector with the same length as the character vector, which would cause the error when the if statement is executed.
I modified my own local version to ensure that the class() function returns a single character value, rather than a character vector with multiple elements. I believe this problem is fixed if "class(y)" is replaced with "class(y[1,1])"
I would suggest implementing this in the gbm package
In the gbm.fit function i got thrown the error "Error in if (nrow(x) != ifelse(class(y) == "Surv", nrow(y), length(y))) { : the condition has length > 1"
I think this is because the condition inside the if statement is not a single logical value, but rather a vector of logical values.
This error is likely to occur if the class() function is being applied to the y vector or matrix, and the result is a character vector with more than one element. For example, if y is a matrix with multiple columns, and each column has a different class, then the class() function will return a character vector with one element for each column in y. In this case, the ifelse() function would return a logical vector with the same length as the character vector, which would cause the error when the if statement is executed.
I modified my own local version to ensure that the class() function returns a single character value, rather than a character vector with multiple elements. I believe this problem is fixed if "class(y)" is replaced with "class(y[1,1])"
I would suggest implementing this in the gbm package