Lasso error in glmnet NA/NaN/Inf
问题 I'm having an issue with glmnet in that I keep getting the error message "Error in elnet(x, is.sparse, ix, jx, y, weights, offset, type.gaussian, : NA/NaN/Inf in foreign function call (arg 5) In addition: Warning message: In elnet(x, is.sparse, ix, jx, y, weights, offset, type.gaussian, : NAs introduced by coercion" Below I can replicate the error with the 'iris' data set, but here is the simplified code for my particular data: vars <- as.matrix(ind.vars) lasso <- glmnet(vars, y=cup98$TARGET