title: Error with cross validation and lasso regularization for logistic regression
body: <p>I want to create a 5-fold CV logistic regression model with lasso regularization, but I get this error message: <code>Something is wrong; all the RMSE metric values are missing:</code>. </p>
  
  <p>I started with logistic regression with lasso regularization by setting <code>alpha=1</code>. This works. I expanded from <a href="https://stats.stackexchange.com/questions/156098/cross-validating-lasso-regression-in-r">this example</a>. </p>
  
  <pre><code># Load data set
  data("mtcars")
  
  # Prepare data set 
  x   &lt;- model.matrix(~.-1, data= mtcars[,-1])
  mpg &lt;- ifelse( mtcars$mpg &lt; mean(mtcars$mpg), 0, 1)
  y   &lt;- factor(mpg, labels = c('notEfficient', 'efficient'))
  
  #find minimum coefficient
  mod_cv &lt;- cv.glmnet(x=x, y=y, family='binomial', alpha=1)
  
  #logistic regression with lasso regularization
  logistic_model &lt;- glmnet(x, y, alpha=1, family = "binomial",
                           lambda = mod_cv$lambda.min)
  </code></pre>
  
  <p>I read that the <code>glmnet</code> function already does 10-fold cv. But I want to use 5-fold cv. So when I add that modification using <code>n_folds</code> to <code>cv.glmnet</code>, I can't find the minimum coefficient nor can I just make the model when modifying <code>trControl</code>.</p>
  
  <pre><code>#find minimum coefficient by adding 5-fold cv
  mod_cv &lt;- cv.glmnet(x=x, y=y, family='binomial', alpha=1, n_folds=5)
  
  
  #Error in glmnet(x, y, weights = weights, offset = offset, #lambda = lambda,  : 
  #  unused argument (n_folds = 5)
  
  #logistic regression with 5-fold cv
      # define training control
      train_control &lt;- trainControl(method = "cv", number = 5)
  
  # train the model with 5-fold cv
  model &lt;- train(x, y, trControl = train_control, method = "glm", family="binomial", alpha=1)
  
  #Something is wrong; all the Accuracy metric values are missing:
  #    Accuracy       Kappa    
  #Min.   : NA   Min.   : NA  
  # 1st Qu.: NA   1st Qu.: NA  
  # Median : NA   Median : NA  
  # Mean   :NaN   Mean   :NaN  
  # 3rd Qu.: NA   3rd Qu.: NA  
  # Max.   : NA   Max.   : NA  
   # NA's   :1     NA's   :1  
  </code></pre>
  
  <p>Why does the error arise when I add 5-fold cv?</p>