title: Include NA as a possible subsetting factor with ddply
body: <p>I want to be able to run tests on my data by all possible combinations of categorical variables, including the possibility of subsetting by just one and not the others. As an example, take the following data:</p>
  
  <pre><code>dbh &lt;- runif(100,5,40)
  err &lt;- runif(100,0,4)
  height &lt;- dbh^.8 + err
  elevation &lt;- factor(rep(c("L","M","H"),100)[1:100], levels=c("L","M","H",NA))
  aspect &lt;- factor(rep(c("E","W"),50), levels=c("E","W",NA))
  dat &lt;- data.frame(dbh, height, aspect, elevation)
  </code></pre>
  
  <p>To get the mean dbh for all combinations of aspect and elevation I tried</p>
  
  <pre><code>library(plyr)
  result &lt;- ddply( dat, c("elevation","aspect"), summarise, mean(dbh))
  </code></pre>
  
  <p>However, this only takes the mean of the following subsets: </p>
  
  <pre><code>  elevation aspect      ..1
  1         L      E 26.07509
  2         L      W 23.78510
  3         M      E 26.72313
  4         M      W 20.88566
  5         H      E 19.63125
  6         H      W 18.60170
  </code></pre>
  
  <p>And I would like it to take the mean of the following:</p>
  
  <pre><code>factors &lt;- data.frame(elevation = rep(c("H","M","L",NA),3),
     aspect = c(rep("E",4),rep("W",4), rep(NA,4)))
  
     elevation aspect
  1       H     E
  2       M     E
  3       L     E
  4    &lt;NA&gt;     E
  5       H     W
  6       M     W
  7       L     W
  8    &lt;NA&gt;     W
  9       H  &lt;NA&gt;
  10      M  &lt;NA&gt;
  11      L  &lt;NA&gt;
  12   &lt;NA&gt;  &lt;NA&gt;
  </code></pre>
  
  <p>Can ddply be coerced to return this result?</p>