PL/R

PL/R is a procedural language for PostgreSQL that allows you to write functions and triggers in R as opposed to PL/pgSQL. All databases come with the extension available, but you need to enable it:

CREATE EXTENSION plr;

Once enable you can create your functions by specifying the plr language on CREATE FUNCTION:

CREATE OR REPLACE FUNCTION r_max (integer, integer) RETURNS integer ASif (arg1 > arg2)
return(arg1)
else
return(arg2)LANGUAGE ’plr’ STRICT;

PLR currently does not come with additional libraries installed, to request those please reach our within the support system of Crunchy Bridge.