title: Group_by returns just one row while aggregate returns the expected outcome
body: <p>I am currently stuck at the post-processing of some EddyData. Following an example (<a href="https://github.com/bgctw/REddyProc/blob/master/vignettes/aggUncertainty.md" rel="nofollow noreferrer">https://github.com/bgctw/REddyProc/blob/master/vignettes/aggUncertainty.md</a>) I came up with an unexpected outcome of <code>group_by</code> which is reproducible but I don't understand why.</p>
  
  <p>Group_by returns just one row while aggregate gives the expected outcome.</p>
  
  <p>Here is a minimal example: </p>
  
  <pre><code>library(tidyverse)
  
  #create example data frame
  date.time &lt;- seq(from=as.POSIXct("2015-01-01 00:30:00"), to=as.POSIXct("2015-01-03 00:30:00"),by="30 mins")
  nee &lt;- runif(length(date.time),-200,200)
  df &lt;- data.frame(date.time, nee)
  
  #calculate day of the year
  df &lt;- df %&gt;% mutate(
    date.time = df$date.time
    , DoY = as.POSIXlt(date.time - 15*60)$yday # midnight belongs to the previous
  )
  
  #trying to summarise nee for each day
  aggDay &lt;- df %&gt;% group_by(DoY) %&gt;% summarise(nee=sum(nee))
  aggDay
         nee
  1 322.1195
  </code></pre>
  
  <p>aggDay just returns one row while <code>aggregate</code> would work in this case</p>
  
  <pre><code>aggregate(df$nee, by=list(df$DoY), sum)
    Group.1          x
  1       0  -25.15698
  2       1  448.13960
  3       2 -100.86310
  </code></pre>
  
  <p>Unfortunately, the original code involves some further calculations which is the reason why I'd like to stay with <code>group_by</code>.</p>
  
  <pre><code>#original code, not reproducible here
  aggDay &lt;- df %&gt;% group_by(DoY) %&gt;% 
    summarise(
      DateTime = first(DateTime)
      , nRec = sum( NEE_uStar_fqc == 0, na.rm = TRUE)
      , nEff = computeEffectiveNumObs(
        resid, effAcf = !!autoCorr, na.rm = TRUE)
      , NEE = mean(NEE_uStar_f, na.rm = TRUE)
      , sdNEE = if (nEff &lt;= 1) NA_real_ else sqrt(
        mean(NEE_uStar_fsd^2, na.rm = TRUE) / (nEff - 1)) 
      , sdNEEuncorr = if (nRec == 0) NA_real_ else sqrt(
        mean(NEE_uStar_fsd^2, na.rm = TRUE) / (nRec - 1))
    )
  </code></pre>