as.data.frame.odbcDataset: Coerce an odbcDataset Object to Another Form

Description Usage Arguments Value Author(s) See Also Examples

Description

These functions coerce odbcDataset objects to data frames, lists, or matrices. Because the whole data set is returned, these aren't of much use.

Usage

1
2
3
4
5
6
## S3 method for class 'odbcDataset'
as.data.frame(x, row.names, optional, ...)
## S3 method for class 'odbcDataset'
as.list(x, ...)
## S3 method for class 'odbcDataset'
as.matrix(x, ...)

Arguments

x

an odbdDataset object.

row.names, optional, ...

ignored.

Value

A data frame, list, or matrix.

Author(s)

John Fox

See Also

odbcDataset, odbcDriverConnect, Prestige.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
## These examples 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
as.data.frame(Prestige)
as.list(Prestige)
as.matrix(Prestige) # note: all entries coerced to character
  
## End(Not run)

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