title: glmnet predict method throwing cryptic error
body: <p>I am trying to make a prediction using <code>glmnet</code>, and getting a very cryptic error message. 
  I have not encountered this before when using <code>glmnet</code>, and Googling for the error was not fruitful. The error happens when the last line is un-commented.</p>
  
  <pre><code>library(ISLR)
  library(glmnet)
  
  
  Hitters=na.omit(Hitters)
  Hitters$Salary = log(Hitters$Salary)
  
  Hitters.train = Hitters[1:200,]
  Hitters.test = Hitters[201:dim(Hitters)[1],]
  
  x=model.matrix(Salary~.,Hitters)[,-1]
  cv.out=cv.glmnet(x, Hitters$Salary, alpha=0)
  bestlam=cv.out$lambda.min
  ridge.mod=glmnet(x, Hitters$Salary, alpha=0,lambda=bestlam)
  
  newx = data.matrix(Hitters.test)
  #ridge.pred=predict(ridge.mod,s=bestlam,newx=newx)
  </code></pre>
  
  <p>Error output:</p>
  
  <pre><code>Loading required package: Matrix
  Loading required package: methods
  Loaded glmnet 1.9-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: Cholmod error 'X and/or Y have wrong dimensions' at file ../MatrixOps/cholmod_sdmult.c, line 90
  Calls: %*% -&gt; %*% -&gt; t
  Calls: predict ... predict.elnet -&gt; NextMethod -&gt; predict.glmnet -&gt; as.matrix
  Execution halted
  </code></pre>
  
  <p>Note that changing <code>newx = data.matrix(Hitters.test)</code>
  to <code>newx = model.matrix(Salary~.,Hitters.test)</code> did not help. </p>
  
  <p>As requested, here is the output of <code>sessionInfo()</code> before running.</p>
  
  <pre><code>&gt; sessionInfo()
  R version 3.0.2 (2013-09-25)
  Platform: x86_64-unknown-linux-gnu (64-bit)
  
  locale:
  [1] C
  
  attached base packages:
  [1] stats     graphics  grDevices utils     datasets  methods   base
  </code></pre>
  
  <p>Here is the output after running:</p>
  
  <pre><code>&gt; sessionInfo()
  R version 3.0.2 (2013-09-25)
  Platform: x86_64-unknown-linux-gnu (64-bit)
  
  locale:
  [1] C
  
  attached base packages:
  [1] stats     graphics  grDevices utils     datasets  methods   base
  
  other attached packages:
  [1] glmnet_1.9-5 Matrix_1.1-0 ISLR_1.0
  
  loaded via a namespace (and not attached):
  [1] grid_3.0.2      lattice_0.20-23
  </code></pre>