extract-replace-methods: Extract or replace a part of 'db.obj' objects

Description Usage Arguments Value Author(s) See Also Examples

Description

Operators acting on db.obj objects to extract or replace parts.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
## S4 method for signature 'db.obj'
x$name
## S4 method for signature 'db.obj'
x[[i, j, ...]]
## S4 method for signature 'db.obj,ANY,ANY,ANY'
x[i, j, ..., drop = TRUE]
## S4 replacement method for signature 'db.obj,character'
x$name <- value
## S4 replacement method for signature 'db.obj,integer'
x$name <- value
## S4 replacement method for signature 'db.obj,numeric'
x$name <- value
## S4 replacement method for signature 'db.obj,logical'
x$name <- value
## S4 replacement method for signature 'db.obj,db.Rquery'
x$name <- value
## S4 replacement method for signature 'db.obj,ANY,ANY,character'
x[[i, j]] <- value
## S4 replacement method for signature 'db.obj,ANY,ANY,integer'
x[[i, j]] <- value
## S4 replacement method for signature 'db.obj,ANY,ANY,numeric'
x[[i, j]] <- value
## S4 replacement method for signature 'db.obj,ANY,ANY,logical'
x[[i, j]] <- value
## S4 replacement method for signature 'db.obj,ANY,ANY,db.Rquery'
x[[i, j]] <- value
## S3 replacement method for class 'db.obj'
x[i, j] <- value

Arguments

x

A db.obj (either db.table, db.view, or db.Rquery) from which to extract element(s).

i, j, ...

Indices specifying elements to extract or replace. Indices are ‘numeric’ or ‘character’ vectors or db.Rquery object or empty (missing) or ‘NULL’.

name

A string. The column name.

value

Any valid value, including db.Rquery, character, numeric, integer, and logical object. The value that is used to replace the part of the db.obj.

drop

Not implemented yet.

Value

A db.Rquery object is returned. For the extraction methods, this is a SQL query to extract the requested subset. For the replacement methods, this is a SQL query representing the modified version of x.

Author(s)

Author: Predictive Analytics Team at Pivotal Inc.

Maintainer: Frank McQuillan, Pivotal Inc. [email protected]

See Also

subset,db.obj-method Operator to extract elements

Examples

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

x$area <- x[["length"]] * x[,"height"] # add a new column

y <- x[,-c(1,2)] # use all columns except the first two

db.disconnect(cid, verbose = FALSE)

## End(Not run)

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