Next: split() Up: MacAnova Help File Previous: solve()   Contents


sort(x [ ,down:T]), x REAL or CHARACTER or a structure with all REAL
  or all CHARACTER components.

Keywords: ordering
sort(x) sorts the data in a REAL or CHARACTER vector x into ascending

sort(x, down:T) or simply sort(x,T) sorts the data in descending order.

If x is a matrix, sort(x) or sort(x,T) is a matrix each of whose columns
contains the ordered elements of the corresponding column of x.

If x is an array, sort(x) or sort(x,T) is an array of the same size and
shape with all the elements with fixed values of subscripts 2, 3,
... defining a "column" which is sorted.  An array with dimension > 2 is
always treated as an array and not as a matrix, even if there are at
most two dimensions greater than 1.

With REAL data, any MISSING values in a column are sorted to the end of
the column, regardless of the direction of the sort.

With CHARACTER data, elements are sorted using the ASCII collating
sequence in which most punctuation and all numerals sort ahead of upper
case letters which sort ahead of lower case letters.  A space sorts
ahead of all printable characters.  Here is the explicit ordering
starting with space:

It is also acceptable for x to be a structure, whose non-structure
components are all REAL or all CHARACTER.  In that case, sort() returns
a structure of the same form, each of whose non-structure components is
the result of applying sort() to the corresponding component of x.

See also grade(), rank().

Gary Oehlert 2003-01-15