Nicely done Elijah!

It has a pretty solution in tacit as well

    vec=. 49 275 93 275 92 99 91 49
   t=. i.~ \:~
   t vec
6 0 3 0 4 2 5 6

Cheers, bob

> On Mar 15, 2023, at 13:59, Elijah Stone <elro...@elronnd.net> wrote:
> 
> One thing that comes to mind is (\:~vec) i.vec.
> 
> On Wed, 15 Mar 2023, Devon McCormick wrote:
> 
>> Hi, has anyone looked into how to generate a rank numbering where duplicate
>> values get duplicate order numbers?
>> 
>> For example, when we rank this vector descending,
>>  \:vec=. 49 275 93 275 92 99 91 49
>> 1 3 5 2 4 6 0 7
>> we see that 1 3{vec and 0 7{vec are the same so I would like to end up with
>> a rank numbering like this 6 0 3 0 4 2 5 6  so the ties for first and last
>> place get the same value in the proper order where zero designates the
>> highest.
>> 
>> I know I've done this before and I have a very clumsy way to achieve this
>> but I'm wondering if there's a better one.
>> 
>> Thanks,
>> 
>> Devon
>> 
>> -- 
>> 
>> Devon McCormick, CFA
>> 
>> Quantitative Consultant
>> ----------------------------------------------------------------------
>> For information about J forums see http://www.jsoftware.com/forums.htm
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm

----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to