Re: [R] How to get the values of a vector having the indices?

From: Uwe Ligges <ligges_at_statistik.uni-dortmund.de>
Date: Sat 18 Jun 2005 - 22:36:50 EST

Amir Safari wrote:

>
>
> Hi
> I want to get the values of a vector which I have its indices. How it is possible?
> For example after clustering , I can access to the indices of the first cluster using:
> first<- which(clusters$clustering==1)
> first give me the indices, but how can I access to the values?

By indexing the original object with these indices. See, e.g., help("[")

If you mean something different, please provide a short reproducible example. and explain what you like to get exactly.

Uwe Ligges

> Thanks a lot and have a fun.
> Amir
>
> __________________________________________________
>
>
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Sat Jun 18 22:52:05 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:32:51 EST