[R] Time series: xts/zoo object at annual (yearly) frequency

John miaojpm at gmail.com
Fri Oct 6 08:56:27 CEST 2017


Hi,

   I'd like to make a time series at an annual frequency.

> a<-xts(x=c(2,4,5), order.by=c("1991","1992","1993"))
Error in xts(x = c(2, 4, 5), order.by = c("1991", "1992", "1993")) :
  order.by requires an appropriate time-based object
> a<-xts(x=c(2,4,5), order.by=1991:1993)
Error in xts(x = c(2, 4, 5), order.by = 1991:1993) :
  order.by requires an appropriate time-based object

  How should I do it? I know that to do for quarterly or monthly time
series, we use as.yearqtr or as.yearmon. What about annual?

   Thanks,

John

	[[alternative HTML version deleted]]



More information about the R-help mailing list