title: model.matrix dropping a column
body: <p>I have a data frame, that I am wanting to use to generate a design matrix. </p>
  
  <pre><code>&gt;ct&lt;-read.delim(filename, skip=0, as.is=TRUE, sep="\t", row.names = 1)
  &gt; ct
        s2 s6 S10 S14 S3 S7 S11 S15 S4 S8 S12 S16
  group  1  1   1   1  2  2   2   2  3  3   3   3
  donor  1  2   3   4  1  2   3   4  1  2   3   4
  &gt;factotum&lt;-apply(ct,1,as.factor) # to turn rows into factors. 
  &gt;design &lt;- model.matrix(~0 + factotum[,1] + factotum[,2])
  </code></pre>
  
  <p>Eventually, I'll generate a string and use as.formula() instead of hard coding the formula. Anyway, this works and produces a design matrix. It leaves a column out though. </p>
  
  <pre><code>&gt;design
     factotum[, 1]1 factotum[, 1]2 factotum[, 1]3 factotum[, 2]2 factotum[, 2]3 factotum[, 2]4
  1               1              0              0              0              0              0
  2               1              0              0              1              0              0
  3               1              0              0              0              1              0
  4               1              0              0              0              0              1
  5               0              1              0              0              0              0
  6               0              1              0              1              0              0
  7               0              1              0              0              1              0
  8               0              1              0              0              0              1
  9               0              0              1              0              0              0
  10              0              0              1              1              0              0
  11              0              0              1              0              1              0
  12              0              0              1              0              0              1
  </code></pre>
  
  <p>By my reasoning, the column names should be:
  factotum[, 1]1 factotum[, 1]2 factotum[, 1]3, factotum[,2]1, factotum[, 2]2 factotum[, 2]3 factotum[, 2]4. These would be renamed as group1,group2,group3,donor1,donor2,donor3,donor4. </p>
  
  <p>Which means that factotum[,2]1, or donor1, is missing. What am I doing that this would be missing? Any help would be be appreciated. </p>
  
  <p>Cheers
  Ben. </p>