
Hey Stefano, You should pass the arguments to the R function directly using a sub-query. You can do that by using double brackets, e.g. CREATE TABLE mytable AS ( SELECT <fields….> FROM table1 AS a, my_R_function( (SELECT a.field1,... FROM table1) ) AS asd WHERE <some conditions> ) WITH DATA; However, this will likely do a cross product between table1 and the result of your R function, and I doubt that is your intention here. You should use an explicit join instead of an implicit join, e.g. SELECT <fields..> FROM table1 AS a INNER JOIN my_R_function((SELECT field1,... FROM table1)) AS b ON <join condition> Regards, Mark ----- Original Message ----- From: "Stefano Fioravanzo" <fioravanzos@gmail.com> To: "users-list" <users-list@monetdb.org> Sent: Monday, May 30, 2016 4:37:10 PM Subject: embedded R function not working Hello, I have the following query: CREATE TABLE mytable AS ( SELECT <fields….> FROM table1 AS a, my_R_function(a.field1, ...) AS asd WHERE <some conditions> ) WITH DATA; MonetDB says: SELECT: no such column ‘a.field1’ The issue is in how I call the R function, since when I remove it everything’s just fine. My aim is to call the function for each row of table1. The new table will have a couple of fields from table1 and a bunch of other fields computed from the R function. How am I supposed to do that? Thank you, Stefano _______________________________________________ users-list mailing list users-list@monetdb.org https://www.monetdb.org/mailman/listinfo/users-list