title: How to remove na values from data frame using ddply?
body: <p>Hopefully you guys can help me out. I've been looking all over the web, and I can't find an answer.
  Here's my data frame: </p>
  
  <pre><code>name    city    state   stars    main_category
  A   Pittsburgh  PA       5.0     Soul Food
  B   Houston     TX       3.0     Professional Services
  C   Lafayette   IN       3.0     NA
  D   Los Angeles CA       4.0     Local Services
  E   Los Angeles CA       3.0     Local Services
  F   Lafayette   IN       3.5     Mongolian
  G   Pittsburgh  PA       5.0     Doctors
  H   Pittsburgh  PA       4.0     Soul Food
  I   Houston     TX       4.0     Professional Services
  </code></pre>
  
  <p>What I would like for it to do is to output the rank by grouping cities (alphabetically) with state and then rank by the amount of stars gotten. Here's what I was hoping for:</p>
  
  <pre><code>name    city    state   stars    main_category              rank
  I   Houston     TX       4.0     Professional Services       1  
  B   Houston     TX       3.0     Professional Services       2
  F   Lafayette   IN       3.5     Mongolian                   1
  D   Los Angeles CA       4.0     Local Services              1
  E   Los Angeles CA       3.0     Local Services              2
  G   Pittsburgh  PA       5.0     Doctors                     1
  A   Pittsburgh  PA       5.0     Soul Food                   1
  H   Pittsburgh  PA       4.0     Soul Food                   2
  </code></pre>
  
  <p>Here's my line of code. </p>
  
  <pre><code>l &lt;- ddply(d, c("city", "state", "main_category"), na.rm=T, transform, rank=rank(-stars, ties.method="max"))
  </code></pre>
  
  <p>This does not remove the NA that Lafayette has. And I don't know what to put, I also tried na.omit, but when I tried that, the rank column does not show up. </p>