OrderBy: Order By

Description Usage Arguments Details Value Author(s) See Also

Description

Orders the data based on simple comparison between rows.

Usage

1
2
3

Arguments

data

A waypoint.

inputs

A named list of expressions, with the names being used as the corresponding outputs. These expressions are outputted in addition to those used to specify the sorting.

If no name is given and the corresponding expression is simply an attribute, then said attribute is used as the name. Otherwise an error is thrown, as there is no reason to include an extra input if corresponding output column cannot be referenced later.

If this is not given, then each attribute of data that is not used exactly as an expression for comparison is included.

outputs

The usual way to specify the outputs. If both this and names for the inputs are given, a warning is given and outputs is used.

limit

The maximum number of tuples to include. If this is given as a positive integer, then only the first limit rows are kept.

Because ties are randomly broken, some rows may be discarded while rows that tie with them are kept.

rank

Either NULL or an attribute name. In the latter case, a column is included in the result whose value is the numeric rank of that row, e.g. 1, 2, ...

...

Specification of ordering. See ‘details’ for more information.

Details

Given a list of expressions and directions, the data is sorted by evaluating the expressions for each row and placing the rows according to the given directions. The expressions are evaluated in order, with earlier expressions given more precdence. If there is a tie for all expressions for two distinct rows, then the order in which they appear in the result is random.

The direction for each expression is given as either 'asc' or 'dsc'. The combination of the direction and a corresponding expression is specified as a call, with the direction being the function and the only argument being the expression.

For example, if the comparison operators are specified as dsc(a), asc(b), then rows with larger values for a appear before those with smaller values. In the case of a tie, rows with smaller values for b appear before those with larger values.

Value

A waypoint with the designated columns and rows.

Author(s)

Jon Claus, <jonterainsights@gmail.com>, Tera Insights, LLC.

See Also

ExtremeTuples for a similarly functioning GLA.


tera-insights/gtBase documentation built on May 31, 2019, 8:35 a.m.