[R] Getting a date out of an indice in a time series

2010-01-11 Thread Idgarad
I have a weekly data set imported via: tsSource=ts(sh1$I000,start=c(2004,1),freq=52) I am now getting to some 'spit and polish' but I realize something I can't wrap my head around. Given an outlier I find at say tsSource[54] ... how can get translate index 54 into the date\week. I mean I can

Re: [R] Getting a date out of an indice in a time series

2010-01-11 Thread Gabor Grothendieck
You cannot faithfully map year and week to ts since years do not have the same number of weeks and ts can only represent regular series. If you wish to use ts for this and you want it to be faithful then use ts(x) and 1 will represent the first week, 2 the second, etc. Then if o is a Date class