I am trying to find examples of a PL / R function that can accept two postgres tables. The PL / R docs do not provide such an example.
To have working examples, consider using the merge of two postgres tables on the R side.
Having two tables in postgres
CREATE TABLE x (a numeric, b text); CREATE TABLE y (a numeric, d text); INSERT INTO x VALUES (1, 'a'),(2, 'b'); INSERT INTO y VALUES (2, 'b'),(3, 'c');
I want to replace the following query
SELECT * FROM x INNER JOIN y ON xa=ya;
With the PL / R function defined in R as:
my_function = function(x, y){ merge(x, y, by = "a") }
I managed to call the PL / R function, which takes one table, but not two.
source share