Sort Dataset by a Column

DESCRIPTION:

Sorts the values in a column (or columns) of a 1- or 2-dimensional dataset.

USAGE:

sort.col(target, columns.to.sort, columns.to.sort.by=<<see below>>, 
         ascending=T) 

REQUIRED ARGUMENTS:

target
1- or 2-dimensional dataset in which the values of the column(s) will be sorted. A 1-dimensional dataset is considered to be a single, unnamed column.
columns.to.sort
logical, integer, or character (name-matching) vector specifying the column(s) of target whose values are to be sorted. To specify all columns of target, use "@ALL" or ""; to specify the last column of target, use "@END" or "".

OPTIONAL ARGUMENTS:

columns.to.sort.by
logical, integer, or character (name-matching) vector specifying the column(s) of target which is/are to be used in determining the sort ordering. Specifying multiple columns means that (after the first column) subsequent columns will be used to break ties, if any, in the values of the previous column. To specify all columns of target, use "@ALL" or ""; to specify the last column of target, use "@END" or "". The default is columns.to.sort.
ascending
logical flag: if TRUE, the values in the columns.to.sort column(s) of target will be sorted in ascending order; if FALSE, the values will be sorted in descending order.

VALUE:

The target dataset with the values in the columns.to.sort column(s) sorted in order of columns.to.sort.by and ascending. If target has row names, the row names of the result will also be sorted.

SEE ALSO:

, , , , , , , , .

EXAMPLES:

# sort diffgeom and complex test scores by statistics test scores 
testscores.bystats <- sort.col(testscores, c("diffgeom","complex"), 
                               "statistics", F)