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

Gabor Grothendieck ggrothendieck at gmail.com
Sun Jun 5 20:16:48 CEST 2011


On Sun, Jun 5, 2011 at 2:14 PM, Ulrich Staudinger <ustaudinger at gmail.com> wrote:
> Hi Dirk,
>
> but I don't have a POSIXct object, I have an xts time series object and want
> the timestamps as seconds/milliseconds with the goal to save it to a
> database ...
>

Try this assuming x is an xts object with POSIXct times:

z <- as.zoo(x)
time(z) <- as.numeric(time(z) - start(z))


-- 
Statistics & Software Consulting
GKX Group, GKX Associates Inc.
tel: 1-877-GKX-GROUP
email: ggrothendieck at gmail.com



More information about the R-SIG-Finance mailing list