Description Objects from the Class Slots Methods Author(s) See Also Examples
An object representing an SQLite database containing both the location of the file
as well as a TableSchemaList object describing the structure of the database.
Objects can be created by calls of the form Database(tbsl, db.file).
tbsl:Object of class "TableSchemaList" representing the current or desired database schema
db.file:Single file path to the desired location of the database
connection:An object of class "SQLiteConnection"
signature(obj = "Database"): Return a logical value indicating if the database connection is open
signature(obj = "Database"): Returns a list of the database table columns indexed by table name
signature(obj = "Database"): Returns the file path associated with the database
signature(obj = "Database"), ..., use.tables = NULL, should.debug = FALSE: Populate an SQLite database using the schema and location from the Database object and the data to be inserted as specified in the  dta.func element of the TableSchemaList.  The use.tables argument can be used to limit the tables populated.  The should.debug argument outputs more verbose messages regarding the SQL queries.
signature(obj = "Database"): Returns the associated TableSchemaList object
signature(obj = "Database"): Returns a character vector containing the table names
Daniel Bottomly
| 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 | if (require(Lahman) && require(RSQLite))
{
 baseball.teams <- makeSchemaFromData(TeamsFranchises, name="team_franch")
 baseball.teams <- append(baseball.teams, makeSchemaFromData(Teams, name="teams"))
 
 relationship(baseball.teams, from="team_franch", to="teams") <- franchID ~ franchID
 
 baseball.db <- Database(baseball.teams, tempfile())
 
 tables(baseball.db)
 columns(baseball.db)
 schema(baseball.db)
 
 populate(baseball.db, teams=Teams, team_franch=TeamsFranchises)
 
 examp.con <- dbConnect(SQLite(), dbFile(baseball.db))
 
 dbListTables(examp.con)
 
 head(dbReadTable(examp.con, "teams"))
 head(dbReadTable(examp.con, "team_franch"))
 
 dbDisconnect(examp.con)
 
}
 | 
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.