difftime.default | R Documentation |
Subtracts time2 from time1. If both are of class POSIXt, gives the result in hours.
difftime.default(time1, time2)
difftime.hours(time1, time2)
time1, time2 |
Two time vectors of the same length, either both numeric of both of class POSIXt. |
If time1 and time2 are both numeric then regular subtraction is used, but if
both are of class POSIXt, then difftime
is used and the result is
converted into hours.
difftime.hours
does the same, but only operates on POSIXt objects.
A numeric vector containing the time difference.
Benjamin Rich <mail@benjaminrich.net>
difftime
blk.tad
blk.relativeTime
time1 <- strptime("2011-01-12 16:58", "%Y-%m-%d %H:%M")
time2 <- strptime("2011-01-11 09:13", "%Y-%m-%d %H:%M")
difftime.default(time1, time2) # In hours
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.