difftime.default: Convenience Function for Computing Time Differences

Description Usage Arguments Details Value Author(s) See Also Examples

Description

Subtracts time2 from time1. If both are of class POSIXt, gives the result in hours.

Usage

1
2
difftime.default(time1, time2)
difftime.hours(time1, time2)

Arguments

time1, time2

Two time vectors of the same length, either both numeric of both of class POSIXt.

Details

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.

Value

A numeric vector containing the time difference.

Author(s)

Ben Rich <[email protected]>

See Also

difftime blk.tad blk.relativeTime

Examples

1
2
3
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

benjaminrich/PCSmisc documentation built on Dec. 17, 2017, 12:50 a.m.