Liza Liza - 3 months ago 12
R Question

R: How to extract dates from a time series

How can I extract dates from a times series?
Here is a time series:

x = seq (1, 768)
myts <- ts(x, start=1982, frequency=24)


Originally I needed to create a vector holding date/time data for the
rts
function, The observations start 1982 with 2 measurements per month going till 2013.

Answer

Try:

time(myts)

or perhaps:

library(zoo)
as.yearmon(time(myts))
Comments