dplyr::mutate()
cannot pass arbitrary R functions over a
database connection. This function provides a way to work
around this, by querying the data in chunks
and applying the function to each chunk, which is then
appended back out to a temporary table.
mutate_db(.data, r_fn, col, new_column, n = 5000L, ...)
a dplyr tbl connection to the temporary table in the database
A dplyr::tbl that uses a database connection, tbl_dbi
class.
any R function that can be called on a vector (column) of the table
the name of the column to which the R function is applied.
(Note, dplyr::mutate()
can operate on an arbitrary list of columns,
this function only operates on a single column at this time...)
column name for the new column.
the number of rows included in each chunk, see DBI::dbFetch()
named arguments to be passed to r_fn