title: Uncommon error message converting Matrix to Sparse in R
body: <p>I'm trying to run a LASSO on our dataset, and to do so, I need to convert non-numeric variables to numeric, ideally via a sparse matrix. However, when I try to use the Matrix command, I get the same error:</p>
  
  <pre><code>Error in asMethod(object) : invalid class 'NA' to dup_mMatrix_as_geMatrix
  </code></pre>
  
  <p>I thought this was due to NA's in my data, so I did an na.omit and got the same error. I tried again with a mini subset of my code and got the same error again:</p>
  
  <pre><code>&gt; sparsecombined &lt;- Matrix(combined1[1:10,],sparse=TRUE)
  Error in asMethod(object) : invalid class 'NA' to dup_mMatrix_as_geMatrix
  </code></pre>
  
  <p>This is the data set I tried to convert with that last line of code:</p>
  
  <p><a href="https://i.stack.imgur.com/rhPOr.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/rhPOr.png" alt="enter image description here"></a></p>
  
  <p>Is there anything that jumps out that might prevent sparse conversion?</p>