[R] Need help on index for time series object

Gabor Grothendieck ggrothendieck at gmail.com
Tue Jul 13 23:02:08 CEST 2010


On Tue, Jul 13, 2010 at 3:58 PM, Megh Dal <megh700004 at yahoo.com> wrote:
> Dear all,
>
> Please forgive me if there is a duplicate post; my previous mail perhaps didnt reach the list.......
>
> Let say I have following time series
>
> library(zoo)
>> dat1 <- zooreg(rnorm(10), start=as.Date("2010-01-01"), frequency=1)
>> dat1[c(3, 7,8)] = NA
>> dat1
> 2010-01-01  2010-01-02  2010-01-03  2010-01-04  2010-01-05  2010-01-06  2010-01-07  2010-01-08  2010-01-09  2010-01-10
> 0.31244288 -2.49383257          NA  0.38975582 -1.23040380 -0.09697926          NA          NA -0.63171455  0.15867246
>>
>
> Now I want to get the Indies for the non-NA elements of dat1. Means I want to get a vector like: "1,2,4,5,6,9.10"
>
> Having a time series vector like dat1, is there any straightforward approach to get that?
>

This question has already been answered by others but I was wondering
why do you want that.  What are you going to do with it?



More information about the R-help mailing list