db.data.frame-class {PivotalR} | R Documentation

## Class `"db.data.frame"`

### Description

An object of this class points to a real table/view in the database. No data is transfered into R. Only a minimal amount of information is kept in the object.

### Objects from the Class

Objects can be created by calls of `db.data.frame` or `as.db.data.frame`.

The object represents a real table/view in the database. Usually it is NOT recommended to directly manipulate the internal slots of these objects.

### Slots

`.name`:

  Object of class `"character"`. It is the table name if this `db.data.frame` was created using just a table name. It can also be a two-element array if this `db.data.frame` was created. This slot is obsolete.

`.content`:

  Object of class `"character"`. The table name. The function `content` can get this value.

`.conn.id`:

  Object of class `"numeric"`, an integer. The ID number of the database connection where the table resides. The functions `conn.id` and `conn.id<-` can get and set this value.

`.col.name`:

  Object of class `"character"`. The 1D array of column names of the table/view that this `db.data.frame` points to. The S4 method `names,db.obj-method`

gets this value.

`.col.data_type`:

  Object of class `"character"`. The 1D array of column data types of the table/view that this `db.data.frame` points to. This is not supposed to be used by the normal user.

`.col.udt_name`:

  Object of class `"character"`. The 1D array of column udt names of the table/view that this `db.data.frame` points to. This is not to used by normal users.

`.table.type`:

  Object of class `"character"`. The information about the type of tha table/view that this `db.data.frame` points to, for example, "BASE TABLE", "VIEW" or "LOCAL TEMPORARY".

`.is.factor`:

  Object of class `"logical"`. An array of logical values which indicate whether each column of the table/view is a factor. This is not to be used by the normal users.

`.factor.suffix`:

  Object of class `"character"`. An array of strings for every column. When creating dummy columns for a factor column, we add a random string in the names of the dummy columns to avoid naming conflicts. So a factor column's `.factor.suffix` is a random string, otherwise it is just an empty string. This is not to be used by the normal users. It is used only the MADlib wrapper functions that support categorical variables.

`.factor.ref`:

  The value of the factor reference level for the regressions. If it is `NA`, then the regressions automatically select a reference level.

`.appear.name`:

  Object of class `"character"`. This is also related the factor columns. `print.lm.madlib` and `print.logregr.madlib` use this value for printing the names of the dummy columns. This is not to be used by the normal users.

`.dummy`:

  Object of class `"character"`. An array of strings, The dummy column names which are used only for factor support.

`.dummy.expr`:

  Object of class `"character"`. The SQL expressions used to create dummy column names which are used only for factor support.

`.dist.by`:

  A string, the distribution policy when using Greenplum database or HAWQ. It can be `character(0)`, which means the data table is distributed randomly. Or it can be a string of column names separated by comma, which are the columns that are used in the "distributed by" when the table was created.

### Extends

Class `db.obj`, directly.

### Methods

`Aggregate functions`, `by,db.obj-method`, `dim,db.table-method`, `dim,db.view-method`, `dim,db.Rquery-method`, `names,db.obj-method`, `conn.id`, `conn.id<-`, `eql`, `key`, `key<-`, `merge,db.obj,db.obj-method`, `print,db.data.frame-method`, `show,db.data.frame-method`, `sort,db.obj-method`, `subset,db.obj-method`, `Arith methods`, `Compare methods`, `Logical methods`, `Extraction methods`, `Replacement methods`, `madlib.lm`, `madlib.glm`, `madlib.summary`

### Author(s)

Author: Predictive Analytics Team at Pivotal Inc.

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

### See Also

`db.data.frame` creates a `db.data.frame` object.

`as.db.data.frame` converts `db.Rquery` object, `data.frame`, or a data file into a `db.data.frame` object and at the same time creates a new table in the database.

`db.obj` is the superclass.

`db.table` and `db.view` are the sub-classes.

`db.Rquery` is another sub-class of `db.obj`.

`lk` or `lookat` display a part of the table

### Examples

    ## Not run:
    showClass("db.data.frame")

    ## 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)

    delete("abalone", conn.id = cid)
    as.db.data.frame(abalone, "abalone", conn.id = cid, verbose = FALSE)
    x <- db.data.frame("abalone", conn.id = cid, verbose = FALSE) # x points to table "abalone"

    lk(x)

    db.disconnect(cid, verbose = FALSE)

    ## End(Not run)

[Package PivotalR version 0.1.18.3.1 Index]