dbApply: Apply a R function to an external MonetDB table.

Description Usage Arguments Value Examples

Description

dbApply uses the R UDF facilities in standalone MonetDB to apply the passed function to a table.

Usage

1
  mdbapply(conn, table, fun, ...)

Arguments

conn

An external MonetDB.R database connection. Created using dbConnect with the MonetDB.R external database driver.

table

An external MonetDB database table. Can also be a view or temporary table.

fun

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

Value

Returns the result of the function applied to the database table.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
## 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
})

## End(Not run)

MonetDBLite documentation built on July 28, 2018, 1:02 a.m.