Re: [R] how to get the index of entry with max value in an array?

2007-01-18 Thread Feng Qiu
Thank you guys! I got it.

Best,

Feng

- Original Message - 
From: Benilton Carvalho [EMAIL PROTECTED]
To: Feng Qiu [EMAIL PROTECTED]
Cc: r-help@stat.math.ethz.ch
Sent: Thursday, January 18, 2007 12:20 AM
Subject: Re: [R] how to get the index of entry with max value in an array?


 which.max()
 b
 
 On Jan 17, 2007, at 11:20 PM, Feng Qiu wrote:
 
 Hi all:
  A short question:
  For example,  a=[3,4,6,2,3], obviously the 3rd entry of  
 the array has the maxium value, what I want is index of the maxium  
 value: 3. is there a neat expression to get this index?

 Thank you!

 Best,

 Feng

__
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
and provide commented, minimal, self-contained, reproducible code.


[R] how to get the index of entry with max value in an array?

2007-01-17 Thread Feng Qiu
Hi all:
 A short question:
 For example,  a=[3,4,6,2,3], obviously the 3rd entry of the array has 
the maxium value, what I want is index of the maxium value: 3. is there a neat 
expression to get this index? 

Thank you!

Best,

Feng


[[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
and provide commented, minimal, self-contained, reproducible code.


Re: [R] how to get the index of entry with max value in an array?

2007-01-17 Thread talepanda
In R language, one solution is:

a-c(3,4,6,2,3)
which(a==max(a))


On 1/18/07, Feng Qiu [EMAIL PROTECTED] wrote:
 Hi all:
  A short question:
  For example,  a=[3,4,6,2,3], obviously the 3rd entry of the array
 has the maxium value, what I want is index of the maxium value: 3. is there
 a neat expression to get this index?

 Thank you!

 Best,

 Feng


   [[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
 and provide commented, minimal, self-contained, reproducible code.


__
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
and provide commented, minimal, self-contained, reproducible code.


Re: [R] how to get the index of entry with max value in an array?

2007-01-17 Thread Christos Hatzis
Or
which.max(a)

-Christos 

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of talepanda
Sent: Wednesday, January 17, 2007 11:45 PM
To: Feng Qiu
Cc: r-help@stat.math.ethz.ch
Subject: Re: [R] how to get the index of entry with max value in an array?

In R language, one solution is:

a-c(3,4,6,2,3)
which(a==max(a))


On 1/18/07, Feng Qiu [EMAIL PROTECTED] wrote:
 Hi all:
  A short question:
  For example,  a=[3,4,6,2,3], obviously the 3rd entry of the 
 array has the maxium value, what I want is index of the maxium value: 
 3. is there a neat expression to get this index?

 Thank you!

 Best,

 Feng


   [[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
 and provide commented, minimal, self-contained, reproducible code.


__
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
and provide commented, minimal, self-contained, reproducible code.

__
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
and provide commented, minimal, self-contained, reproducible code.


Re: [R] how to get the index of entry with max value in an array?

2007-01-17 Thread Prof Brian Ripley
?which.max
?which.is.min

On Wed, 17 Jan 2007, Feng Qiu wrote:

 Hi all:
 A short question:
 For example,  a=[3,4,6,2,3], obviously the 3rd entry of the array has 
 the maxium value, what I want is index of the maxium value: 3. is there a 
 neat expression to get this index?

 Thank you!

 Best,

 Feng


   [[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
 and provide commented, minimal, self-contained, reproducible code.


-- 
Brian D. Ripley,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595

__
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
and provide commented, minimal, self-contained, reproducible code.


Re: [R] how to get the index of entry with max value in an array?

2007-01-17 Thread jim holtman
which.max

 a - sample(1:10,10)
 a
 [1]  3  4  5  7  2  8  9  6 10  1
 which.max(a)
[1] 9




On 1/17/07, Feng Qiu [EMAIL PROTECTED] wrote:

 Hi all:
 A short question:
 For example,  a=[3,4,6,2,3], obviously the 3rd entry of the array
 has the maxium value, what I want is index of the maxium value: 3. is there
 a neat expression to get this index?

 Thank you!

 Best,

 Feng


[[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
 and provide commented, minimal, self-contained, reproducible code.




-- 
Jim Holtman
Cincinnati, OH
+1 513 646 9390

What is the problem you are trying to solve?

[[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
and provide commented, minimal, self-contained, reproducible code.


Re: [R] how to get the index of entry with max value in an array?

2007-01-17 Thread Benilton Carvalho
which.max()
b

On Jan 17, 2007, at 11:20 PM, Feng Qiu wrote:

 Hi all:
  A short question:
  For example,  a=[3,4,6,2,3], obviously the 3rd entry of  
 the array has the maxium value, what I want is index of the maxium  
 value: 3. is there a neat expression to get this index?

 Thank you!

 Best,

 Feng

__
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
and provide commented, minimal, self-contained, reproducible code.