title: Working with time values greater than 24 hours in R
body: <p>I'm trying to perform calculations on time values that are greater than 24 hours.  In this short example, I'm trying to calculate someone's sleep duration based on their bedtime and waketime.  If bedtime is after midnight, however, the data are entered as time values greater than 24 hours.  For example, if someone went to sleep at 2am, their bedtime value is 26:00:00.  How can I handle time values greater than 24 hours in R?</p>
  
  <p>Here's my short example attempt:</p>
  
  <pre><code>library(chron)
  
  bedtime &lt;- c("22:37:34","23:03:32","24:41:23")
  waketime &lt;- c("06:41:23","07:25:18","08:47:08")
  
  bedtimeAsTime &lt;- chron(times=bedtime) #results in error
  waketimeAsTime &lt;- chron(times=waketime)
  
  #Add 24 hours
  waketimeAsTime &lt;- waketimeAsTime + 1
  
  sleepDuration &lt;- waketimeAsTime - bedtimeAsTime
  </code></pre>
  
  <p>The chron function does not accept the time value greater than 24 hours and converts it to NA.  Any ideas for how to deal with this?</p>
  
  <p>Thanks in advance!</p>