title: How to aggregate data frame and keep missing values
body: <p>I have a data frame (data_test) of bird data where multiple counts of the same species can occur in the same location (ponds or transects). I would like to aggregate the data so there is one total count per species per location. I have missing values for the coordinates of some locations, but I don't want those records to be dropped out of the dataset. 
  Here's the data: </p>
  
  <pre><code># Create data table
  location &lt;- c("pondA","pondA","transect1","pondB","pondB","transect2","pondC","transect3","pondD","transect4")
  type &lt;- c("ground","ground","air","ground","ground","air","ground","air","ground","air")
  easting &lt;- c(NA,NA,18264,NA,NA,46378,NA,86025,NA,46295)
  northing &lt;-c(NA,NA,96022,NA,NA,85766,NA,21233,NA,23090)
  species &lt;- c("NOPI","NOPI","SCAU","GWTE","GWTE","RUDU","NOPI","GADW","NOPI","MALL")
  count &lt;- c(10,23,50,1,2,43,12,3,7,9)
  data_test &lt;- data.frame(location=location,type=type,easting=easting,northing=northing,species=species,count=count)
  data_test
  </code></pre>
  
  <p>When I use the aggregate function, it drops out the records with missing easting and northing values: </p>
  
  <pre><code>aggregate(count ~ species + location + type + easting + northing, data=data_test, FUN=sum)
  </code></pre>
  
  <p>Results in: </p>
  
  <pre><code>  species  location type easting northing count
  1    GADW transect3  air   86025    21233     3
  2    MALL transect4  air   46295    23090     9
  3    RUDU transect2  air   46378    85766    43
  4    SCAU transect1  air   18264    96022    50
  </code></pre>
  
  <p>Using na.action=NULL doesn't work because the summation isn't operating on the easting or northing fields. What I want is: </p>
  
  <pre><code>  species  location   type easting northing count
  1    NOPI     pondA ground      NA       NA    33
  2    SCAU transect1    air   18264    96022    50
  3    GWTE     pondB ground      NA       NA     3    
  4    RUDU transect2    air   46378    85766    43
  5    NOPI     pondC ground      NA       NA    12
  6    GADW transect3    air   86025    21233     3
  7    NOPI     pondD ground      NA       BA     7
  8    MALL transect4    air   46295    23090     9
  </code></pre>
  
  <p>Any help much appreciated. </p>