title: Error in predict() glmnet function: not-yet-implemented method
body: <p>When i use the predict glmnet function, i get the error mentioned below the code.</p>
  <pre><code>mydata &lt;- read.csv(&quot;data.csv&quot;)
  x &lt;- mydata[,1:4]
  y &lt;- mydata[,5]
  data &lt;- cbind(x,y)
  model &lt;- model.matrix(y~., data=data)
  ridgedata &lt;- model[,-1]
  train &lt;- sample(1:dim(ridgedata)[1], round(0.8*dim(ridgedata)[1]))
  test &lt;- setdiff(1:dim(ridgedata)[1],train)
  x_train &lt;- data[train, ]
  y_train &lt;- data$y[train]
  x_test &lt;- data[test, ]
  y_test &lt;- data$y[test]
  k=5
  grid =10^seq(10,-2, length =100)
  fit &lt;- cv.glmnet(model,y,k=k,lambda = grid)
  lambda_min &lt;- fit$lambda.min
  fit_test &lt;- predict(fit, newx=x_test,s=lambda_min)
  </code></pre>
  <p>The error is as follows:</p>
  <blockquote>
  <p>Error in <code>as.matrix(cbind2(1, newx) %*% nbeta)</code> :    error in evaluating
  the argument 'x' in selecting a method for function 'as.matrix': Error
  in <code>cbind2(1, newx) %*% nbeta</code> :    not-yet-implemented method for
  <code>&lt;data.frame&gt; %*% &lt;dgCMatrix&gt;</code></p>
  </blockquote>
  <p>I tried debugging, but i am not sure where the</p>
  <blockquote>
  <p>as.matrix(cbind2(1, newx) %*% nbeta)</p>
  </blockquote>
  <p>code is being used and what is causing this error.</p>