[R] Time series and non-integer seconds

Dirk Eddelbuettel edd at debian.org
Tue Apr 13 19:13:25 CEST 2010


On 13 April 2010 at 18:49, Jeszenszky Péter wrote:
| Hello,
| 
| How to handle time series data if the sampling period is a fraction of
| a second? Classes such as POSIXct, chron and timeDate stores only integer
| second values. Although class POSIXlt suports fractions of a second,
| neither package zoo nor package xts handle POSIXlt date/time objects.

Of course they do and they use POSIXct which was extended to cover fractional
seconds to microsecond precisions.

Set    

       options("digits.secs"=6)    

and see for yourself:

    R> now <- Sys.time()
    R> now + 1:5*0.100   # 100 msec incre
    [1] "2010-04-13 12:12:42.950103 CDT" "2010-04-13 12:12:43.050103 CDT" 
    [3] "2010-04-13 12:12:43.150103 CDT" "2010-04-13 12:12:43.250103 CDT"
    [5] "2010-04-13 12:12:43.350103 CDT"
    R> 

Dirk

-- 
  Registration is open for the 2nd International conference R / Finance 2010
  See http://www.RinFinance.com for details, and see you in Chicago in April!



More information about the R-help mailing list