Description Usage Arguments Details See Also
a call to 'dbUpdateTable()' executes the sql to update records for a target database using the data in the 'data.update' data-frame. The default method provided, 4 SQL statements are generated to perform the update: a call to 'dbCreateTable()'; a call to 'dbAlterTabledatecreates and populates a temporary table using the data provided the 'data.update' dataframe
1 2 | dbUpdateTable(con, target.table, data.update, set = NULL, by = NULL,
...)
|
con |
an S4 object that inherits from DBIConnection. This object is used to communicate with the database engine |
target.table |
A character string specifying the unquoted DBMS table name, or the result of a call to dbQuoteIdentifier(). |
data.update |
a data.frame (or coercible to data.frame). |
set |
a named character vector of varibles If NULL, the default, then the function expects the data.update to be a grouped data.frame. The UPDATE statement will be constructed to match the ungrouped columns in the 'data.update' dataset with identically names columns in the target database table. If not NULL, then a character vector provides the names of the columns to join the database table to the dataframe. example by = c("symbol", "date"). Use a named vector by = c("col1" = "col2") to match columns with different names in the database target table and the supplied data.update dataset. |
by |
a character vector of variables to join. If NULL, the default, then the function expects the data.update to be a grouped data.frame. The grouped columns will be matched with identically named columns the database table to construct the inner join clause the the update statement. A message lists the variables so that you can check they're right (to suppress the message, simply explicitly list the variables that you want to join). If not NULL, then a character vector provides the names of the columns to join the database table to the dataframe. example by = c("symbol", "date"). Use a named vector by = c("col1" = "col2") to match columns with different names in the database target table and the supplied data.update dataset. |
An UPDATE statement is then constructed by the dbUpdateTable() method. The generated sql is then passed to dbExecute().
Other DBIConnection generics: dbAddIndex
,
dbAddPrimaryKey
,
dbDeleteAllRecords
,
dbDropTable
, dbReplaceInTable
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.