sort-methods: Sort a table or view by a set of columns

sortR Documentation

Sort a table or view by a set of columns

Description

This function is used to sort a table of view in the database.

Usage

## S4 method for signature 'db.obj'
sort(x, decreasing = FALSE, INDICES, ...)

Arguments

x

The signature of the method. A db.obj (includes db.table and db.view) object, which points to a table or view in the database.

decreasing

A logical, with default value as FALSE. Should the sort be increasing or decreasing?

INDICES

A list of db.Rquery objects. Each of the list element selects one or multiple columns of x. NULL to order by random().

...

Further arguments passed to or from other methods. This is currently not implemented.

Value

A db.Rquery object. It is the query object used to sort the db.obj in the database.

Author(s)

Author: Predictive Analytics Team at Pivotal Inc.

Maintainer: Frank McQuillan, Pivotal Inc. fmcquillan@pivotal.io

See Also

by has similar syntax to this function.

lk or lookat to view portion of the data table

Examples

## Not run: 


## set up the database connection
## Assume that .port is port number and .dbname is the database name
cid <- db.connect(port = .port, dbname = .dbname, verbose = FALSE)

x <- as.db.data.frame(abalone, conn.id = cid, verbose = FALSE)
lk(x, 10)

y  <- sort(x, decreasing = FALSE, list(x$id, x$sex) )
# get the SQL query to be run
content(y)
# get the sorted output
lk(y, 20)

db.disconnect(cid, verbose = FALSE)

## End(Not run)

greenplum-db/GreenplumR documentation built on Sept. 2, 2023, 8:09 a.m.