I am just beginning to discover all the advantages of using R
& monetDB
/monetDBLite
package - great stuff!
I was curious however if it's possible to use a custom defined function in dplyr
's mutate()
i.e.
# Connect to monetDBLite
db <- src_monetdb(embedded = db.dir)
data <- tbl(db, "my.table")
# Try to make a new column using custom defined function
data %>% group_by(colX) %>% mutate(NewCol = customFunc())
Results in the following error:
Error in .local(conn, statement, ...) :
Unable to execute statement 'SELECT colA colB colC...'.
Server says 'ParseException:SQLparser:SELECT: no such operator 'customFunc''.
It seems like the SQL parser has a problem finding the custom function. Am I overseeing something (declare R
code in a SQL
function definition etc.) ? Is it possible to use custom defined functions with the monetDBLite
package like this?