Sort rows or columns of matrix according to row or column summaries
matsusort input_matrix output_matrix [, columns decrease summary(statistic)]
Description
matsusort by default sorts rows of input_matrix according their order by some numeric summary (by default, the mean of the elements in each row) and puts the resulting matrix into output_matrix. input_matrix and output_matrix may have the same name.
matsusort with the columns option sorts columns of input_matrix according their order by some numeric summary (by default, the mean of the elements in each column) and puts the resulting matrix into output_matrix. input_matrix and output_matrix may have the same name.
Options
columns specifies that columns should be sorted, not rows as is the default.
decrease specifies that rows and/or columns should be sorted in decreasing order of the numeric summary. The default is increasing order.
summary specifies a summary statistic. The argument must be one of the results left behind by summarize, that is, one of N mean sum sum_w min max sd Var p1 p5 p10 p25 p50 p75 p90 p95 p99 skewness kurtosis.
Examples
. matsusort A B
. matsusort A B, su(max)
Author
Nicholas J. Cox, University of Durham, U.K. n.j.cox@durham.ac.uk
Also see