[Jprogramming] Rank numbering with duplicates
Devon McCormick
devonmcc at gmail.com
Wed Mar 15 22:24:09 UTC 2023
These are both way better than what I came up with. Thanks!
On Wed, Mar 15, 2023 at 5:07 PM 'robert therriault' via Programming <
programming at jsoftware.com> wrote:
> 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 <elronnd at 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
>
--
Devon McCormick, CFA
Quantitative Consultant
More information about the Programming
mailing list