execute_custom_R_udf: Executing a local R function as a UDX in Vertica

Description Usage Arguments Examples

Description

This function allows for a local R function to be run on vertica as a user defined function and returns a vertica.dplyr table as the output. The prerequisite udx called vertica_function_executor must be installed to use this function.

Usage

1
execute_custom_R_udf(fun, tbl, ..., libraries)

Arguments

fun

An R function to be run in vertica as a user defined function. The function must input a data.frame and also output a data.frame

tbl

A vertica.dplyr table object to be passed into the function

...

Additional arguments that are passed to the function. The size of the objects passed to vertica (this includes the function passed) must be less than 30 MB

libraries

A vector of library names to be loaded before the function is executed. These libraries must be already installed on Vertica

Examples

1
2
3
4
5
6
7
8
9
## Not run: 
library(randomForest)
model <- randomForest(Species ~ ., iris,ntree = 1)
copy_to(vertica, iris, "iris_table")
iris_table <- tbl(vertica, "iris_table")
result <- execute_custom_R_udf(function(x) {library(randomForest); predict(model,x)}, iris_table, model = model, libraries = c("randomForest"))


## End(Not run)

vertica/vertica.dplyr documentation built on May 3, 2019, 6:11 p.m.