[R] Getting Rid of NaN in ts Object

Lorenzo Isella lorenzo.isella at gmail.com
Fri May 27 12:14:32 CEST 2016


Dear All,
I am sure the answer is a one liner, but I am banging my head against
the wall and googling here and there has not helped much.
Consider the following time series

tt<-structure(c(NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN,
NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, 1133.09, 1155.77, 1179.12,
1182.85, 1133.43, 1103.36, 1081.19, 1058.55, 1056.95, 1059.13,
1018.18, 920.62, 865.99, 856.29, 841.58, 857.7, 852.71, 890.76
), .Tsp = c(1980, 2015, 1), class = "ts")


where the NaN do *not* occur internally. How can I automatically get
rid of them and adjust the start and end year of the time series
accordingly?
Many thanks

Lorenzo



More information about the R-help mailing list