title: How to convert by the minute data to hourly average data
body: <p>I have one week of data with a reading every 5 seconds. An example of data is below.</p>
  
  <pre><code>9/1/2012 00:00:00    1
  9/1/2012 00:00:05    2
  9/1/2012 00:00:10    3
  </code></pre>
  
  <p>I want to calculate the hourly average for each day. Then make a multi-line plot of  "average hourly reading vs. hour" with lines representing different dates.</p>
  
  <p>The one I have here is for weekly average</p>
  
  <pre><code>data$date = as.POSIXct(strptime(data$date, 
                    format = "%d/%m/%Y %H:%M","GMT")) 
  means &lt;- aggregate(data["nox"], format(data["date"],"%Y-%U"),
                   mean, na.rm = TRUE) 
  </code></pre>
  
  <p>For daily average, it is</p>
  
  <pre><code>data$date = as.POSIXct(strptime(data$date, 
                   format = "%d/%m/%Y %H:%M","GMT"))
  means &lt;- aggregate(data["nox"], format(data["date"],"%Y-%j"),
                   mean, na.rm = TRUE) 
  </code></pre>
  
  <p>Any one knows how to calculate the hourly average for each day.</p>