Megh,

I don't know whether this is the best way, but it works:

> seq(1,length(dat1))[!is.na(dat1)]
[1]  1  2  4  5  6  9 10

Jonathan


On Tue, Jul 13, 2010 at 1:58 PM, Megh Dal <megh700004@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?
>
> Thanks and regards,
>
> ______________________________________________
> R-help@r-project.org mailing list
> 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]]

