Please enable JavaScript to view this site.

Vensim Help

Navigation: Reference Guide > Functions > Arrays, Vectors, and Subscripts

VECTOR RANK(vec,direction) RANK of elements in a VECTOR

Scroll Prev Top Next More

The VECTOR RANK function returns a new vector that specifies the rank of the elements in vec.  If direction is greater than 0 the entries are ranked from smallest to biggest, otherwise from biggest to smallest.  The first ranked element has a rank of 1, the second of 2 and so on. If two elements are the same the will arbitrarily be assigned contiguous ranks. Do NOT use the result of this function with VECTOR REORDER as this will return meaningless results.

Example

company : (c1-c5)

revenue[company] = 5000,3000,8000

revenue rank[company] = VECTOR RANK(revenue[company],1)

Will return 2,1,3 for revenue rank.

Units: VECTOR RANK(units,dmnl) --> dmnl

Restrictions: Must appear first on the right and can’t be followed by anything else.  Ranking is done on the complete vector relative to the last subscript.  Subranges will not work.

See Also: VECTOR REORDER, VECTOR SORT ORDER

Availability: Professional and DSS only.

 

Sample model: VECTOR RANK + REORDER + SORT ORDER.mdl in FunctionExamples