[R] zoo, time() & index()

Achim Zeileis Achim.Zeileis at uibk.ac.at
Mon Aug 2 10:51:47 CEST 2010


On Mon, 2 Aug 2010, Costas wrote:

> Hi,
>
> I have to zoo real valued time series "a" and "b" same length.
>
> is index(a)<-index(b) same as time(a)<-time(b)?

Yes.

> Which one is better?

Neither.

index() has been introduced because zoo series do not necessarily have to 
be indexed by "time". In such situations it might feel unnatural to use 
time().

Vice versa, when the data are indeed a time series, time() is more 
natural.

Internally in zoo functions, we typically use index. Personally, when 
doing time series calculations, I use time().

Best,
Z



More information about the R-help mailing list