sendData | R Documentation |
These functions copy data frames to database tables
sendData(db, data, table = deparse(substitute(data)), ...) ## S4 method for signature 'CredentialsList,data.frame' sendData(db, data, table, ..., applyFun = lapply) ## S4 method for signature 'Credentials,data.frame' sendData(db, data, table, chunkSize = Inf, ...) ## S4 method for signature 'DBIConnection,data.frame' sendData(db, data, table = deparse(substitute(data)), ...) ## S4 method for signature 'MySQLConnection,data.frame' sendData(db, data, table, ..., mode = "insert") ## S4 method for signature 'MariaDBConnection,data.frame' sendData(db, data, table, ..., mode = "insert")
db |
one in: |
data |
A data.frame (or coercible to data.frame) |
table |
A character string specifying a DBMS table name |
... |
arguments passed to methods and to reTry |
applyFun |
(function) something like lapply or mclapply |
chunkSize |
An integer specifying the number of rows send to the db at
a time. Defaults to |
mode |
One of "insert", "replace", or "truncate" |
Basically, these functions are intended to behave like dbWriteTable. However, there are two notebale exceptions:
append is always set to TRUE, i.e. the target database table must be created or already exist before sendData is called
row.names is always set to FALSE, i.e., row.names must be converted to a variable if you want to keep them
There are four different modes for sending data to the database:
INSERT INTO TABLE, i.e. in case of duplicates only the first entry will be kept
REPLACE INTO TABLE, i.e. in case of duplicates only the last entry will be kept
like dbWriteTable with argument overwrite = TRUE, i.e., the table is truncated before sending the data
like insert but falls back to update on duplicate key
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.