Dear R-List, I have the habit of using R for my data processing and I like to use the power of the lattice package. Presently, I have to manage time series. So, in order to work properly I want to discover the zoo package and the related methods (since lattice can work with zoo class). But my physical experiment lasts only one second and my sampling period is equal to 1 microsecond (the date time value is given by the IRIG Card for my data acquisition card). I read the R-News june 2004 about the date time Classes in R and there is no information about allowing for the microseconds. So do you think it is really a good idea to try to use the R time series framework (zoo package for example) with my data ? Or would there be a tip ? Thank you very much Laurent
zoo is independent of time and date class so it does not restrict your choice of index class. POSIXct supports sub-microsecond accuracy. See ?POSIXct . Simply using the number of microseconds since the start of the experiment is another possibility. On Sat, Feb 6, 2010 at 8:25 AM, Laurent Rhelp <LaurentRHelp at free.fr> wrote:> Dear R-List, > > ?I have the habit of using R for my data processing and I like to use the > power of the lattice package. Presently, I have to manage time series. So, > in order to work properly I want to discover the zoo package and the related > methods (since lattice can work with zoo class). But my physical experiment > lasts only one second and my sampling period is equal to 1 microsecond (the > date time value is given by the IRIG Card for my data acquisition card). I > read the R-News june 2004 about the date time Classes in R and there is no > information about allowing for the microseconds. So do you think it is > really a good idea to try to use the R time series framework (zoo package > for example) with my data ? Or would there be a tip ? > > Thank you very much > > Laurent > > ______________________________________________ > 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. >
Gabor Grothendieck a ?crit :>zoo is independent of time and date class so it does not restrict your >choice of index class. POSIXct supports sub-microsecond accuracy. >See ?POSIXct . Simply using the number of microseconds since the >start of the experiment is another possibility. > >On Sat, Feb 6, 2010 at 8:25 AM, Laurent Rhelp <LaurentRHelp at free.fr> wrote: > > >>Dear R-List, >> >> I have the habit of using R for my data processing and I like to use the >>power of the lattice package. Presently, I have to manage time series. So, >>in order to work properly I want to discover the zoo package and the related >>methods (since lattice can work with zoo class). But my physical experiment >>lasts only one second and my sampling period is equal to 1 microsecond (the >>date time value is given by the IRIG Card for my data acquisition card). I >>read the R-News june 2004 about the date time Classes in R and there is no >>information about allowing for the microseconds. So do you think it is >>really a good idea to try to use the R time series framework (zoo package >>for example) with my data ? Or would there be a tip ? >> >>Thank you very much >> >>Laurent >> >>______________________________________________ >>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. >> >> >> > > >Thank you, I will see in details the POSIXct class.
Depending on how you are using POSIXct, you accuracy is limited to the microsecond level. It is stored as a floating point number with 54 bit of accuracy (~16 digits) and currently the number of seconds since 1/1/1970 is 10 digits, so with microseconds adding 6 more, you are at the limit:> x <- Sys.time() > x[1] "2010-02-06 09:34:58 EST"> unclass(x)[1] 1265466899> x[1] "2010-02-06 09:34:58 EST"> y <- x+.000001 > x-yTime difference of -9.536743e-07 secs> y <- x+.0000001 > x-yTime difference of 0 secs> y <- x+.000001 # 1 us > identical(x,y)[1] FALSE> y <- x+.0000001 # 0.1 us > identical(x,y)[1] TRUE>On Sat, Feb 6, 2010 at 9:41 AM, Laurent Rhelp <LaurentRHelp at free.fr> wrote:> Gabor Grothendieck a ?crit : > >> zoo is independent of time and date class so it does not restrict your >> choice of index class. ?POSIXct supports sub-microsecond accuracy. >> See ?POSIXct . ?Simply using the number of microseconds since the >> start of the experiment is another possibility. >> >> On Sat, Feb 6, 2010 at 8:25 AM, Laurent Rhelp <LaurentRHelp at free.fr> >> wrote: >> >>> >>> Dear R-List, >>> >>> I have the habit of using R for my data processing and I like to use the >>> power of the lattice package. Presently, I have to manage time series. >>> So, >>> in order to work properly I want to discover the zoo package and the >>> related >>> methods (since lattice can work with zoo class). But my physical >>> experiment >>> lasts only one second and my sampling period is equal to 1 microsecond >>> (the >>> date time value is given by the IRIG Card for my data acquisition card). >>> I >>> read the R-News june 2004 about the date time Classes in R and there is >>> no >>> information about allowing for the microseconds. So do you think it is >>> really a good idea to try to use the R time series framework (zoo package >>> for example) with my data ? Or would there be a tip ? >>> >>> Thank you very much >>> >>> Laurent >>> >>> ______________________________________________ >>> 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. >>> >>> >> >> > > Thank you, I will see in details the POSIXct class. > > ______________________________________________ > 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 Cincinnati, OH +1 513 646 9390 What is the problem that you are trying to solve?
jim holtman a ?crit :>Depending on how you are using POSIXct, you accuracy is limited to the >microsecond level. It is stored as a floating point number with 54 >bit of accuracy (~16 digits) and currently the number of seconds since >1/1/1970 is 10 digits, so with microseconds adding 6 more, you are at >the limit: > > > >>x <- Sys.time() >>x >> >> >[1] "2010-02-06 09:34:58 EST" > > >>unclass(x) >> >> >[1] 1265466899 > > >>x >> >> >[1] "2010-02-06 09:34:58 EST" > > >>y <- x+.000001 >>x-y >> >> >Time difference of -9.536743e-07 secs > > >>y <- x+.0000001 >>x-y >> >> >Time difference of 0 secs > > >>y <- x+.000001 # 1 us >>identical(x,y) >> >> >[1] FALSE > > >>y <- x+.0000001 # 0.1 us >>identical(x,y) >> >> >[1] TRUE > > > > >On Sat, Feb 6, 2010 at 9:41 AM, Laurent Rhelp <LaurentRHelp at free.fr> wrote: > > >>Gabor Grothendieck a ?crit : >> >> >> >>>zoo is independent of time and date class so it does not restrict your >>>choice of index class. POSIXct supports sub-microsecond accuracy. >>>See ?POSIXct . Simply using the number of microseconds since the >>>start of the experiment is another possibility. >>> >>>On Sat, Feb 6, 2010 at 8:25 AM, Laurent Rhelp <LaurentRHelp at free.fr> >>>wrote: >>> >>> >>> >>>>Dear R-List, >>>> >>>>I have the habit of using R for my data processing and I like to use the >>>>power of the lattice package. Presently, I have to manage time series. >>>>So, >>>>in order to work properly I want to discover the zoo package and the >>>>related >>>>methods (since lattice can work with zoo class). But my physical >>>>experiment >>>>lasts only one second and my sampling period is equal to 1 microsecond >>>>(the >>>>date time value is given by the IRIG Card for my data acquisition card). >>>>I >>>>read the R-News june 2004 about the date time Classes in R and there is >>>>no >>>>information about allowing for the microseconds. So do you think it is >>>>really a good idea to try to use the R time series framework (zoo package >>>>for example) with my data ? Or would there be a tip ? >>>> >>>>Thank you very much >>>> >>>>Laurent >>>> >>>>______________________________________________ >>>>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. >>>> >>>> >>>> >>>> >>> >>> >>Thank you, I will see in details the POSIXct class. >> >>______________________________________________ >>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. >> >> >> > > > > >This is a good piece of advice ! Thank you very much, I will take care of it in my calculations.