title: Error in cv.lars in R
body: <p>I have a question regarding the <strong>cv.lars</strong>. Bellow there is a description for the data I use:</p>
  
  <pre><code>is.numeric(Y$Y1)
  [1] TRUE
  
  length(Y$Y1)
  [1] 589
  
  
  dim(Training_XX[7:ncol(Training_XX)])
  [1]  589 5677
  </code></pre>
  
  <p>I have already run <strong>lasso</strong> using <strong>lars</strong> package. My code is as follows:</p>
  
  <pre><code>LASSO_1&lt;-lars(as.matrix(X[7:ncol(X)]), 
                Y$Y1,type=c("lasso"), 
                normalize=TRUE, use.Gram=FALSE).
  </code></pre>
  
  <p>The above procedure seems to run fine. However, when I'm trying to <strong>cross-validate</strong> for the <strong>lambda</strong> value, I get the following error:</p>
  
  <pre><code>Error in if (zmin &lt; gamhat) { : missing value where TRUE/FALSE needed
  </code></pre>
  
  <p>My code for the cross-validation is:</p>
  
  <pre><code>CV&lt;-cv.lars(as.matrix(X[7:ncol(X)]),Y$Y1,use.Gram=FALSE,max.steps=500)
  lambda_Y1=CV$index[which.min(CV$cv)]
  </code></pre>
  
  <p>Does anyone has any idea what's going on? I really don't know what that error means and what's wrong with my data (and or code).</p>