Re: [R] ranking a vector in R

2012-06-21 Thread Prof Brian Ripley
On 21/06/2012 07:24, Petr Savicky wrote: On Thu, Jun 21, 2012 at 12:24:47AM +0200, Jessy wrote: Hello, May someone help me with how in R I can rank a vector from highest to lowest. i.e rank 1 (smallest rank) is given to the highest value instead of the usual way that it get's the highest rank

Re: [R] ranking a vector in R

2012-06-21 Thread arun
Hi, > dat<-c(5,4,3,12,15) > rank(-dat) [1] 3 4 5 2 1 > rank(dat) [1] 3 2 1 4 5 A.K. - Original Message - From: Jessy To: r-help@r-project.org Cc: Sent: Wednesday, June 20, 2012 6:24 PM Subject: [R] ranking a vector in R Hello, May someone help me with how in R I can r

Re: [R] ranking a vector in R

2012-06-21 Thread Christian Brechbühler
On Wed, Jun 20, 2012 at 6:24 PM, Jessy wrote: > May someone help me with how in R I can rank a vector from highest to > lowest. i.e rank 1 (smallest rank) is given to the highest value instead > of the usual way that it get's the highest rank. > How about rank(-v), e.g., > > rank(-c(3,1,4,6,5)

Re: [R] ranking a vector in R

2012-06-20 Thread Petr Savicky
On Thu, Jun 21, 2012 at 12:24:47AM +0200, Jessy wrote: > Hello, > > > May someone help me with how in R I can rank a vector from highest to > lowest. i.e rank 1 (smallest rank) is given to the highest value instead > of the usual way that it get's the highest rank. Hello: Try x <- c(3, 2, 4

Re: [R] ranking a vector in R

2012-06-20 Thread Jorge I Velez
Hi Jessy, ?sort ?rank will be a good starting point. HTH, Jorge.- On Wed, Jun 20, 2012 at 6:24 PM, Jessy wrote: > Hello, > > > May someone help me with how in R I can rank a vector from highest to > lowest. i.e rank 1 (smallest rank) is given to the highest value instead > of the usual way

[R] ranking a vector in R

2012-06-20 Thread Jessy
Hello, May someone help me with how in R I can rank a vector from highest to lowest. i.e rank 1 (smallest rank) is given to the highest value instead of the usual way that it get's the highest rank. Regards, Jessy [[alternative HTML version deleted]] __