With the latest CRAN version of maxnet, when the data matrix provided to maxnet() has only one column, a cryptic error message is produced:
library(maxnet)
data(bradypus)
p <- bradypus$presence
data <- bradypus[, 2, drop = FALSE]
mod <- maxnet(p, data)
# Error in apply(pdata, 1, function(rr) !any(apply(ndata, 1, function(r) identical(r, :
# dim(X) must have a positive length
This can be quite hard to debug, especially in scripts which include previous elimination of variables (e.g. due to collinearity) where the user is not aware of how many variables actually reach the model. I think this is fixed by the instances of drop=FALSE in the GitHub version of maxnet, but it would be very useful to get it on CRAN as well. Cheers!
With the latest CRAN version of
maxnet, when thedatamatrix provided tomaxnet()has only one column, a cryptic error message is produced:This can be quite hard to debug, especially in scripts which include previous elimination of variables (e.g. due to collinearity) where the user is not aware of how many variables actually reach the model. I think this is fixed by the instances of
drop=FALSEin the GitHub version ofmaxnet, but it would be very useful to get it on CRAN as well. Cheers!