Add Data to a Database

Share:

Description

Adds a data.frame to a database table by its row.names.

Usage

1
2
3
4
5
Add2DB(myData,
       dbFile,
       tblName = "Seqs",
       clause = "",
       verbose = TRUE)

Arguments

myData

Data frame containing information to be added to the dbFile.

dbFile

A SQLite connection object or a character string specifying the path to the database file.

tblName

Character string specifying the table in which to add the data.

clause

An optional character string to append to the query as part of a “where clause”.

verbose

Logical indicating whether to display each query as it is sent to the database.

Details

Data contained in myData will be added to the tblName by its respective row.names.

Value

Returns TRUE if the data was added successfully, or FALSE otherwise.

Author(s)

Erik Wright DECIPHER@cae.wisc.edu

References

ES Wright (2016) "Using DECIPHER v2.0 to Analyze Big Biological Sequence Data in R". The R Journal, 8(1), 352-359.

See Also

Seqs2DB, SearchDB, BrowseDB

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
# Create a sequence database
gen <- system.file("extdata", "Bacteria_175seqs.gen", package="DECIPHER")
dbConn <- dbConnect(SQLite(), ":memory:")
Seqs2DB(gen, "GenBank", dbConn, "Bacteria")

# Identify the sequence lengths
l <- IdLengths(dbConn)

# Add lengths to the database
Add2DB(l, dbConn)

# View the added lengths
BrowseDB(dbConn)
dbDisconnect(dbConn)

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.