Reputation:
I am using the following code getting the error message in R version 2.13.1. in mac.
cv.glmnet(dsgn.mat,resp,family="gaussian",nfolds=5)
Error in as.matrix(cbind2(1, newx) %*% nbeta) :
error in evaluating the argument 'x' in selecting a method for function 'as.matrix': Error in t(.Call(Csparse_dense_crossprod, y, t(x))) :
error in evaluating the argument 'x' in selecting a method for function 't': Error: invalid class 'NA' to dup_mMatrix_as_dgeMatrix
I should mention that there is no message if I use only glmnet
then it is working fine.
Upvotes: 1
Views: 2366
Reputation: 22588
Without any example data, all I can say is that, generally, most errors that pop up only during cross validation are because one of the random folds ends up "bad". This is obviously more common if you don't have many observations in your data set. For example, do you have any NAs in your data (might lead to an entire fold of NAs)?
You can get around this by preprocessing your data, but glmnet also will let you directly prescribe the folds via parameter foldid
.
Upvotes: 3