You can also derive what you need using the rle()
function, though the which() solution may be
easier.
-Don
At 4:20 PM -0300 7/5/09, Henrique Dallazuanna wrote:
Content-Type: text/plain
Content-Disposition: inline
Content-length: 944
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.
--
---------------------------------
Don MacQueen
Lawrence Livermore National Laboratory
Livermore, CA, USA
925-423-1062
m...@llnl.gov
______________________________________________
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.