title: rounding times to the nearest hour in R
body: <p>I have data in the format</p>
  
  <pre><code>time &lt;-  c("16:53", "10:57", "11:58")
  </code></pre>
  
  <p>etc</p>
  
  <p>I would like to create a new column where each of these times is rounded to the nearest hour. I cannot seem to get the POSIX command to work for me.  </p>
  
  <blockquote>
    <p>as.character(format(data2$time, "%H:%M"))</p>
  </blockquote>
  
  <p>Error in format.default(structure(as.character(x), names = names(x), dim = dim(x),  : 
    invalid 'trim' argument</p>
  
  <p>Let alone use the round command. Can anyone advise?</p>