[R-SIG-Finance] Solicitation of opinions on which Timeseries object(s) to utilize.

Gabor Grothendieck ggrothendieck at gmail.com
Sat Jun 28 19:51:29 CEST 2008


On Wed, Jan 23, 2008 at 12:10 AM, Joe W. Byers <ecjbosu at aim.com> wrote:
> The certain problems with timeDate objects of Rmetrics is one of the
> reasons I posted this question.  I have found that even though you can
> give the timeSeries a financial center and a zone, the underlying
> timeDate object still defaults to GMT.  I have to pass or set the
> tz='EST5EDT' or something like that to get the correct numerical time
> integers.  I have not quite figured this one out yet.  This may also be
> an underlying problem with other timeseries packages but I thought
> determining the "best" timeseries package before progressing further was
> a better course .
>

Actually this only is about the time index and that may be unrelated to the
time series package.  For example, zoo uses just about any time index
as long as the class supports certain methods so whether or not a particular
time index class is any good may be an orthogonal question.  Its only for
time series classes that have hard coded which time indexes can be used
with them that that might be a consideration.

e.g.

library(zoo)

dts <- c("1989-09-28", "2001-01-15", "2004-08-30", "1990-02-09")

# zoo object with "timeDate" class index
library(fSeries)
zoo(11:14, timeDate(dts))

# zoo object with "Date" class index
zoo(11:14, as.Date(dts))

# zoo object with "POSIXct" class index
zoo(11:14, as.POSIXct(dts))

# zoo object with chron "dates" class index
library(chron)
zoo(11:14, chron(dts, format = "y-m-d"))

# zoo object with "numeric" index
# using number of days since Epoch
zoo(11:14, as.numeric(as.Date(dts)))

# zoo object with "character" class as index
zoo(11:14, dts)



More information about the R-SIG-Finance mailing list