SQLiteDataset: Create an SQLiteDataset Object

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

Description

Create an SQLiteDataset pseudo-data-frame object.

Usage

1
2
3
4
5
6
7
8
SQLiteDataset(table, database=paste(table, ".db", sep=""),
	stringsAsFactors=default.stringsAsFactors())
## S3 method for class 'SQLiteDataset'
print(x, ..., verbose=FALSE)
## S3 method for class 'SQLiteDataset'
summary(object, ..., rows)
## S3 method for class 'SQLiteDataset'
close(con, ...)

Arguments

table

the quoted name of a data table in the database.

database

quoted name of the database file in which the data table is located; if missing, a file named table.db (where “table” is the table argument) in the current directory will be assumed.

stringsAsFactors

if TRUE (the default), character variables are treated as factors; the conversion is done when data are retrieved from the data table.

x, object, con

an object of class SQLiteDataSet.

verbose

if TRUE (the default is FALSE), the whole data set is retrieved and printed; otherwise just some information about the data set is printed.

rows

a quoted SQL query to select rows from the data set; if missing, then all rows are retrieved.

...

arguments to be passed down.

Details

The function SQLiteDataset creates a pseudo-data-frame, which then can be used more or less like a data frame. Use close to close the connection to the database containing the data table referenced by the object.

Value

an object of class SQLiteDataset.

Author(s)

John Fox, jfor@mcmaster.ca.

See Also

read.db, dbDriver, dbConnect, dbDisconnect, $.SQLiteDataset, as.data.frame.SQLiteDataset

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
dr <- dbDriver("SQLite")
tfile <- tempfile()
con <- dbConnect(dr, dbname = tfile)
dbWriteTable(con, "USArrests", USArrests)
dbDisconnect(con)
Arrests <- SQLiteDataset("USArrests", database=tfile)
Arrests
summary(Arrests)
summary(Arrests, rows="Murder > 10")
close(Arrests)


Search within the dfdb package
Search all R packages, documentation and source code

Questions? Problems? Suggestions? or email at ian@mutexlabs.com.

Please suggest features or report bugs with the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.