[R] ts time-object indexing question?

Michael Peng michael.gang.peng at gmail.com
Mon Feb 15 17:17:25 CET 2016


a.ts[time(a.ts)==1965]

2016-02-15 10:53 GMT-05:00 ce <zadig_1 at excite.com>:

>
> Dear all,
>
> I can't find an answer to this simple question:
>
>  a.ts <- ts(1:10, frequency = 1, start = c(1959, 1))
>  > a.ts
> Time Series:
> Start = 1959
> End = 1968
> Frequency = 1
>  [1]  1  2  3  4  5  6  7  8  9 10
>
> Now I want to get let's say value for 1965 , how to get it ?
> > a.ts["1965"]
> [1] NA
>
> doesn't work .
>
> And  how I can get the date of a.ts[5]  ?
>
> ______________________________________________
> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

	[[alternative HTML version deleted]]



More information about the R-help mailing list