SortRows | R Documentation |
Sorts the rows of the table based on the values in the specified column
SortRows(x, decreasing = FALSE, column = NULL, exclude = "NET, SUM, Total")
x |
Input matrix or dataframe which is being sorted. Values must be numeric. Vectors and 1-d arrays will be converted to a matrix. |
decreasing |
Order to sort values. |
column |
The column to sort by. If none is specified and the 'Column n' statistic is present in the table, it will use the column with the largest value of 'Column n'. Otherwise it will pick the right-most column. |
exclude |
A string containing a comma-separated list of rows (either by name or index) which should not be sorted. These rows will remain at the bottom of the output table |
This function differs from the QScript in a number of ways. 1) Sorting does not respect spans. 2) The default column in based on 'Column n' in 'Statistics - Below'. This is not available to R. Instead we pick the column with the largest sum. If there is a tie between columns, we will pick the rightmost column 3) There is no parameter for 'Never exclude from sort'. This is because we require that entries in 'Exclude from sort' must match the rowname exactly, instead of a partial match used in the QScript
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.