Description Usage Arguments Value Author(s) See Also Examples
This function creates an object of
db.data.frame, which points to an existing
table/view in the database. The operations that can be applied
onto this class of objects are very similar to those of
data.frame. No real data is loaded into R. The data transfered
between the database and R is minimized, which is necessary when we
deal with large data sets.
1 2 |
x |
A string. It is the name of an existing table/view in the database. |
conn.id |
An integer, default is 1. The ID number of the database connection where the table resides. |
key |
A string, default is |
verbose |
A logical, default is |
is.temp |
A logical, default is |
A db.data.frame object. More precisely, a db.table
object if it points to an existing table in the database, and a
db.view object
if it points to an existing view in the database.
Author: Predictive Analytics Team at Pivotal Inc.
Maintainer: Frank McQuillan, Pivotal Inc. fmcquillan@pivotal.io
db.objects lists all tables and views in a database
together with their schema.
db.existsObject tests whether a table/view exists in the
database.
as.db.data.frame creates a db.data.frame from a
data.frame, a data file or a db.Rquery.
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 | ## 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)
## create a table using as.db.data.frame
delete("abalone", conn.id = cid)
x <- as.db.data.frame(abalone, "abalone", conn.id = cid)
## create an object pointing to the table
y <- db.data.frame("abalone", conn.id = cid)
## x and y point to the same table
eql(x, y) # returns TRUE
## create an object pointing to a table in a schema
db.q("create schema myschema", conn.id = cid)
z <- as.db.data.frame(abalone, "myschema.abalone", conn.id = cid)
db.q("drop schema myschema cascade", conn.id = cid)
db.disconnect(cid, verbose = FALSE)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.