[R-SIG-Finance] millisec timestamps for rows of xts/zoo object

Dirk Eddelbuettel edd at debian.org
Tue Jun 7 22:14:42 CEST 2011


On 5 June 2011 at 22:49, Ulrich Staudinger wrote:
| Last question here, as.numeric(time(t)) returns seconds since 1970, but not the
| milliseconds, although I enabled it through setting the mentioned options. Any
| hint on that?

Wrong. You once again fell for displayed precision != stored precision:

Here is the example I use days ago:

   R> print( as.numeric( Sys.time() ), digits=20 )
   [1] 1307296635.9376249313
   R> 

whereas when I do it now without the digits= override:

   R> print( as.numeric( Sys.time() ) )
   [1] 1307477616
   R> 

Also:

   R> typeof( as.numeric( Sys.time() ) )
   [1] "double"
   R> 

Dirk

-- 
Gauss once played himself in a zero-sum game and won $50.
                      -- #11 at http://www.gaussfacts.com



More information about the R-SIG-Finance mailing list