Skip to content
Prev 250774 / 398498 Next

leap years in temporal series command ts

On Wed, Feb 16, 2011 at 6:51 AM, Peter Zorglub <peter.zorglub at gmail.com> wrote:
You could do this with an implied frequency of 1

tt <- ts(1:10, start=as.Date("2000-01-01"))

which would represent the times as days since the Epoch. You can
recover the Date class dates with:

as.Date(tt, origin = "1970-01-01")

You might be better off using zoo or xts. e.g.

library(zoo)
z <- zooreg(1:10, start = as.Date("2000-01-01"))

Its also possible to move back and forth:

as.ts(z)
as.zoo(tt)
aggregate(as.zoo(tt), identity, as.Date)