tiedrank in StatsBase does some of what R's rank does. -- John
On Aug 13, 2014, at 2:16 PM, Ryan J. O'Neil <[email protected]> wrote: > I’ve been looking around for this, but if it exists I haven’t been able to > find it in the docs. > > In R, I can use order and rank to provide the permutation order and rank of > the elements in a vector. > > > rank(c(3,5,2,9,8,1,4,7,6)) > [1] 3 5 2 9 8 1 4 7 6 > > > order(c(3,5,2,9,8,1,4,7,6)) > [1] 6 3 1 7 2 9 8 5 4 > It looks like Julia’s sortperm provides the same functionality as order. > > julia> sortperm([3,5,2,9,8,1,4,7,6])' > 1x9 Array{Int64,2}: > 6 3 1 7 2 9 8 5 4 > Is there a version of R’s rank function? > > Thanks, > > Ryan J. O’Neil > http://adventuresinoptimization.blogspot.com/ > @ryanjoneil > >
