[R] which.minimums not which.min

Christos Hatzis christos at silicoinsights.com
Wed Mar 15 20:56:11 CET 2006


Try 

order(x, decreasing=TRUE/FALSE)
  

-----Original Message-----
From: r-help-bounces at stat.math.ethz.ch
[mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of Fred J.
Sent: Wednesday, March 15, 2006 2:32 PM
To: r-help at stat.math.ethz.ch
Subject: [R] which.minimums not which.min

  Hi
   
  Is there a function which determines the location, i.e., index of the all
minimums or maximums of a numeric vector.
  Which.min(x) only finds the (first) of such.
   
  > x <- c(1:4,0:5, 4, 11)
  > x
   [1]  1  2  3  4  0  1  2  3  4  5 4 11
  > which.min(x)
  [1] 5
  > which.max(x)
  [1] 11
  >
   
  but I need
  which.min(x)  to be 5 11
  which.max(x) to be 4 10
   
  thanks
   
  
__________________________________________________



	[[alternative HTML version deleted]]

______________________________________________
R-help at 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




More information about the R-help mailing list