[R] Handling Time in R

jim holtman jholtman at gmail.com
Fri Oct 7 17:34:32 CEST 2011


?ISOdatetime


> x <- ISOdatetime(2011,10,6,16,23,30.539)
> str(x)
 POSIXct[1:1], format: "2011-10-06 16:23:30"
> y <- ISOdatetime(2011,10,6,16,23,30.939)
> difftime(y,x)
Time difference of 0.3999999 secs
>


On Fri, Oct 7, 2011 at 11:04 AM, Alaios <alaios at yahoo.com> wrote:
> Dear all,
> I would like to ask your help regarding handling time stamps in R. I think first I need a reference to read about their logic and how I should handle them.
>
> For example, this is a struct I have
>
>
> str(MyStruct$TimeStamps)
>  num [1:100, 1:6] 2011 2011 2011 2011 2011 ...
>
> MyStruct$TimeStamps[1,]
> [1] 2011.000   10.000    6.000   16.000   23.000   30.539
>
> the last field contains seconds.milliseconds.
>
> How I can for example make calculations with time stamps like see if the
> MyStruct$TimeStamps[1,]-MyStruct$TimeStamps[2,] differ more than 300millisecond, or 3 days have passed?
>
> I would like to thank you in advance for your suggestions
>
> B.R
> Alex
>
>        [[alternative HTML version deleted]]
>
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>
>



-- 
Jim Holtman
Data Munger Guru

What is the problem that you are trying to solve?



More information about the R-help mailing list