Try this:

which(c(0, diff(x)) != 0)


On Sun, Jul 5, 2009 at 4:03 PM, Arun Kumar Saha
<arun.kumar.s...@gmail.com>wrote:

> Hi all,
>
> say, I have following vector :
>
> x <- c(rep(5, 5), rep(3,4), rep(5,10))
>
> Now I want to get the index numbers where elements of that vector changes
> i.e. in above example I want to get a vector with elements : 6, 10. Because
> at that indices, element of original vector changes value.
>
> Is there any R function to do that?
>
> Regards,
>
>        [[alternative HTML version deleted]]
>
> ______________________________________________
> 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.
>



-- 
Henrique Dallazuanna
Curitiba-Paraná-Brasil
25° 25' 40" S 49° 16' 22" O

        [[alternative HTML version deleted]]

______________________________________________
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.

Reply via email to