odbcDataset: Create an odbcDataset Object

Description Usage Arguments Details Value Author(s) See Also Examples

Description

This functions creates an odbcDataset object linked to a table in an ODBC-accessible database. The print method normally prints information about the data set; the summary method summarizes it as a data frame.

Usage

1
2
3
4
5
odbcDataset(channel, table, rownames)
## S3 method for class 'odbcDataset'
print(x, ..., verbose = FALSE)
## S3 method for class 'odbcDataset'
summary(object, ...)

Arguments

channel

a channel to the database, as returned by odbcConnect.

table

the quoted name of a database table.

rownames

TRUE if the first character variable in the data base contains row names; FALSE if there is no row names variable; if not specified, the function will look for a suitable variable in the data base

x, object

an object of class odbcDataset.

verbose

if FALSE, the default, print information about the odbcDataset object; if TRUE, print the whole object as a data frame.

...

ignored.

Details

Possibly further description here.

Value

An object of class odbcDataset, with the following components:

channel

The ODBC channel to the database on which the table resides.

table

The name of the database table.

rownames

TRUE or FALSE.

column.selector

The position of the variable names.

Author(s)

John Fox

See Also

odbcDriverConnect, Prestige.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
## These example presuppose that the data set prestige is stored as a table
## in the database attached via odbcDriverConnect().
## This data set is supplied as the data frame Prestige in the dfdb.RODBC
## package.
## Depending upon your OS/DBMS, the call to odbcDriverConnect() may have
## to be modified.

## Not run: 
channel <- odbcDriverConnect()
            
sqlTables(channel)

Prestige <- odbcDataset(channel, "prestige")  # create a pseudo-dataframe
Prestige
unclass(Prestige)
print(Prestige, verbose=TRUE)
summary(Prestige)
  
## End(Not run)

dfdb.RODBC documentation built on May 2, 2019, 5:18 p.m.