[R-SIG-Finance] Extracting Interval-Based Data From Zoo Series (Rory Winston)

Dirk Eddelbuettel edd at debian.org
Tue Dec 11 20:09:08 CET 2007


On 10 December 2007 at 21:14, icosa atropa wrote:
| I've had similar issues with zoo and POSIXct index uniqueness.  The
| existing documentation requires very careful review.
| 
| To quote Gabor,
| 
| "
| The zoo function and most functions in the zoo package have
| no understanding of date time classes and only require that
| such classes have ordered elements and support certain methods
| as defined in ?zoo so zoo is irrelevant for understanding dates, times
| and timezones.
| [...]
| Also please read the last line of every message to r-help [which asks
| that code be self-enclosed]
| "
| 
| >From ?strptime,
| "
| *     Specific to R is '%OSn', which for output gives the seconds to '0
| *     <= n <= 6' decimal places (and if '%OS' is not followed by a
|       digit, it uses the setting of 'getOption("digits.secs")', or if
| *     that is unset, 'n = 3'). Further, for 'strptime' '%OS' will input
|       seconds including fractional seconds.  Note that '%S' ignore
|       fractional parts on output.
| "
| 
| Try explicitly using %OS3 and make sure your operating system supports
| this by making and examining such a POSIXct vector using duplicated()
| and unique() outside of the read.zoo() call to see what's _actually_
| happening.


Zoo does tolerate identical time stamps for some operations [ which is why
you get a warning but not an error upon construction with identical time
stamps ], but it prefers non-zero differences between timestamps.  

I pad my high-resolution times with an eps=1.0-6 to make them distinct, if
need be.  

Hth, Dirk

-- 
Three out of two people have difficulties with fractions.



More information about the R-SIG-Finance mailing list