db.data.frame | R Documentation |
db.data.frame
object pointing to a table/view in the
database
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.
db.data.frame(x, conn.id = 1, key = character(0), verbose = TRUE,
is.temp = FALSE)
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
.
## 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.