Description Usage Arguments Details Value Author(s) See Also Examples
Computes the number of days between two vectors of class Date or POSIXt. In the latter case, the time portion is ignored.
1 | difftime.days(time1, time2)
|
time1, time2 |
Two vectors of the same length, both either of class Date or POSIXt. |
This function considers the calendar date portion of a POSIXt object only. Thus, a day need not correspond to a 24 hour period (see example).
An integer vector containing the number of days between time1 and time2.
Ben Rich <benjamin.rich@certara.com>
1 2 3 4 5 6 7 8 9 10 | ## Not run:
time1 <- strptime("2011-12-22 00:03", "
time2 <- strptime("2011-12-22 00:01", "
time3 <- strptime("2011-12-21 23:59", "
time4 <- strptime("2011-12-20 00:01", "
difftime.days(time1, time2) # 2 minutes difference, on the same day so considered 0 days
difftime.days(time2, time3) # Also 2 minutes difference but on different days, so considered one day
difftime.days(time3, time4) # Although only 47 hours and 58 minutes difference, still considered one day
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.