Writing an R function and porting it to Vertica

Moderator: NorbertKrupa

Post Reply
Posts: 1
Joined: Tue Mar 22, 2016 7:13 pm

Writing an R function and porting it to Vertica

Post by bwei81490 » Fri Mar 25, 2016 3:25 pm

I've been doing some research on this topic and I found an informative link: http://www.r-bloggers.com/r-and-vertica/

This link details a fairly simply example where you create the function and then create a factory function which tells vertica what kind of data to expect. In this case it's expecting 3 float inputs and output 1 float.

# normal inverse
norm_inv <- function(x) { # 1 - percentile, 2 - mean, 3 - sd
apply(x,1,function(i) qnorm(p=i[1L],mean=i[2L],sd=i[3L]))

norm_invFactory <- function() { # this is the factory function that 'links' between R and Vertica

I'm currently creating a function that has two inputs which are both mixed type dataframes and the output is one resulstset which is also of mixed type eg ( 1000 x 10 matrix)

Does anyone know how I should write the factory function in this case? What is the data type of a dataframe of mixed type?


Post Reply

Return to “Vertica User Defined Functions (UDFs)”