[R] time difference

Stefan stefan at inizio.se
Thu Apr 22 09:49:09 CEST 2010


Carol Gao <carol.gaox <at> gmail.com> writes:

> 
> Hi,
> 
> Does anyone know how to take a time difference when the format of the time
> is as 13:22:23.586? I am trying to take the difference of time between stock
> transactions and need to keep the three decimal places for seconds. I have
> tried *diff(strptime(x, "%H:%M:%S.000))*, but apperantly that doesn't work.
> 
> Carol Gao
> 
> 	[[alternative HTML version deleted]]
> 
> 



I found this:
http://tolstoy.newcastle.edu.au/R/e6/help/09/05/15738.html

It seems to me that this is partly an options issue. Maybe this is something to
work with:

options(digits.secs=3)
strptime(x, "%H:%M:%S%OS")



More information about the R-help mailing list