title: sparseMatrix with numerical and categorical data
body: <p>I am trying to create a sparse matrix with numerical and categorical data which will be used as an input to cv.glmnet.  When only numerical data is involved, I can create a sparseMatrix using the following syntax</p>
  
  <pre><code>sparseMatrix(i=c(1,3,5,2), j=c(1,1,1,2), x=c(1,2,4,3), dims=c(5,2))
  </code></pre>
  
  <p>For categorical variables, the following approach seems to work:</p>
  
  <pre><code>sparse.model.matrix(~-1+automobile, data.frame(automobile=c("sedan","suv","minivan","truck","sedan")))
  </code></pre>
  
  <p>My VERY sparse instance has 1,000,000 observations and 10,000 variables.  I do not have enough memory to first create the full matrix.  The only way I can think of creating a sparseMatrix is to manually handle the categorical variables by creating the columns and converting the data in (i,j,x) format.  I am hoping that somebody can suggest a better approach.</p>