[R] How to find the index
Greg Snow
Greg.Snow at imail.org
Wed Sep 17 18:17:12 CEST 2008
Others have told you about order, also note that order(order(x)) gives the indexes to return a sorted x variable back to its original order.
Hope this helps,
> -----Original Message-----
> From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-
> project.org] On Behalf Of Peng Jiang
> Sent: Tuesday, September 16, 2008 9:05 AM
> To: r-help at r-project.org
> Subject: [R] How to find the index
>
> Dear R experts,
>
> i have a vector z , i have to do something after z is sorted. how
> can i find the original index, i.e., before sorting, of a certain
> element in the sorted vector .
> thanks in advance
>
> regards
> -----------------------------------------------
> Peng Jiang 江鹏 ,Ph.D. Candidate
> Antai College of Economics & Management
> 安泰经济管理学院
> Department of Mathematics
> 数学系
> Shanghai Jiaotong University (Minhang Campus)
> 800 Dongchuan Road
> 200240 Shanghai
> P. R. China
>
> ______________________________________________
> R-help at r-project.org 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.
More information about the R-help
mailing list