
dbApply
uses the R UDF facilities in standalone MonetDB to apply the passed function to a table.
mdbapply(conn, table, fun, ...)
An external MonetDB database table. Can also be a view or temporary table.
A R function to be run on the external database table. The function gets passed a single data.frame
argument which represents the database table. The function needs to return a single vector (for now).
Other parameters to be passed to the function
Returns the result of the function applied to the database table.
# NOT RUN {
library(DBI)
con <- dbConnect(MonetDB.R(), "demo")
data(mtcars)
dbWriteTable(con, "mtcars", mtcars)
mpgplus42 <- mdbapply(con, "mtcars", "double", function(d) {
d$mpg + 42
})
# }
Run the code above in your browser using DataLab