How to assign a rank number to an array when ties exist
<p>I am struggling to know where to start when trying to assign ranks to the numeric values in an array when there are ties. So, for example, I need to turn an array like the following: </p>

<pre><code>myarray = (4,76,34,13,34)
</code></pre>

<p>into another array like:</p>

<pre><code>myarray2 = (1,5,3.5,2,3.5)
</code></pre>

<p>Basically, when the same number occurs more than once in the array, the assigned rank to those numbers is the average of the ranks. So, instead of the two 34s being ranked 3 and 4 they both get assigned 3.5. Similarly, if there were 3 copies of 34 then the 3 assigned ranks would be divided by 3. Any help would be much appreciated!</p>

<p>Many thanks,</p>

<p>Adam</p>
