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

Description Usage Arguments Value Author(s) See Also Examples

Description

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

Usage

1
2
## 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. [email protected]

See Also

by has similar syntax to this function.

lk or lookat to view portion of the data table

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
## 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)

PivotalR documentation built on May 30, 2017, 8:18 a.m.