[R] inverse function of order()

Petr Pikal petr.pikal at precheza.cz
Mon Oct 4 16:56:38 CEST 2004



On 4 Oct 2004 at 16:21, Wolfram Fischer wrote:

> I have:
> 
>  d <- sample(10:100, 9)
>  o <- order(d)
>  r <- d[o]
> 
> How I can get d (in the original order), knowing only r and o?
Hi

try to sort it again

r[order(o)]

(not sure about ties, though)

Cheers
Petr


> 
> Thanks - Wolfram
> 
> ______________________________________________
> 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

Petr Pikal
petr.pikal at precheza.cz




More information about the R-help mailing list