# uses origin = "1970-01-01"
as.Date(0)
# all three result in origin and next 9 days
as.Date(0:9)
as.Date(0) + 0:9
x <- ts(rnorm(10), start = 0)
as.Date(unclass(time(x)))
# annual/quarterly/monthly series:
xa <- ts(rnorm(10), start = 2001)
xq <- ts(rnorm(10), start = 2001, freq = 4)
xm <- ts(rnorm(10), start = 2001, freq = 12)
as.Date(time(xa))
as.Date(time(xq))
as.Date(time(xm))
# using offset argument
xa2 <- ts(rnorm(10))
as.Date(time(xa2), offset = 2000)
Run the code above in your browser using DataLab