[R] Subtracting TimeStamps

David Winsemius dwinsemius at comcast.net
Thu Jun 23 13:39:10 CEST 2011


On Jun 23, 2011, at 7:26 AM, sumit gupta wrote:

> Hi All,,
>
> I am new to R and having a problem dealing with timestamps.
>
> I have 2 columns in my table . Both of these have timestamps value in
> format  06/22/11 05:34 PM .

If these are Date or DateTime objects you can use:

?difftime   # with attention to the units argument
?DateTimeClasses

If they are not yet in a correct class you need to first use:

?strptime

> I want to calculate the difference in these 2
> columns ( in minutes) and save it as a 3rd column.

When examples are provided ....

-- 
David Winsemius, MD
West Hartford, CT



More information about the R-help mailing list