SQLDataFrame-class: SQLDataFrame class

Description Usage Arguments Value Examples

Description

SQLDataFrame constructor, slot getters, show method and coercion methods to DataFrame and data.frame objects.

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
SQLDataFrame(dbname = character(0), dbtable = character(0),
  dbkey = character(0), col.names = NULL)

## S4 method for signature 'SQLDataFrame'
dbname(x)

## S4 method for signature 'SQLDataFrame'
dbtable(x)

## S4 method for signature 'SQLDataFrame'
dbkey(x)

## S4 method for signature 'SQLDataFrame'
dbconcatKey(x)

## S4 method for signature 'SQLDataFrame'
ROWNAMES(x)

## S4 method for signature 'SQLDataFrame'
show(object)

## S4 method for signature 'SQLDataFrame'
as.data.frame(x, row.names = NULL,
  optional = FALSE, ...)

Arguments

dbname

A character string for the database file path.

dbtable

A character string for the table name in that database. If not provided and there is only one table available, it will be read in by default.

dbkey

A character vector for the name of key columns that could uniquely identify each row of the database table.

col.names

A character vector specifying the column names you want to read into the SQLDataFrame.

from

the SQLDataFrame object to be coerced.

Value

A SQLDataFrame object.

Examples

 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
## constructor
dbname <- system.file("extdata/test.db", package = "SQLDataFrame")
obj <- SQLDataFrame(dbname = dbname, dbtable = "state",
                    dbkey = "state")
obj
obj1 <- SQLDataFrame(dbname = dbname, dbtable = "state",
                     dbkey = c("region", "population"))
obj1

## slot accessors
dbname(obj)
dbtable(obj)
dbkey(obj)
dbkey(obj1)

dbconcatKey(obj)
dbconcatKey(obj1)

## ROWNAMES
ROWNAMES(obj[sample(10, 5), ])
ROWNAMES(obj1[sample(10, 5), ])

## coercion
as.data.frame(obj)
as(obj, "DataFrame") 

Liubuntu/SQLDataFrame documentation built on May 17, 2019, 7:43 a.m.