On Wed, Mar 12, 2008 at 09:35:24AM -0700, [EMAIL PROTECTED] wrote:
> In short R appears to have more than enough capability to do the job
> (from a statistical perspective), however there doesnt seem to be that
> much discussion on using the PL/R implementation, or for that matter
> tutorials on using PL/R.

I've not used PL/R either, but I've used R on it's own a bit and I've
done a bit of PL/pgSQL programming as well.

> What I would like to know is:
> 1/ Is is possible to create a view that has its columns based on the
> output of a PL/R function?

You're after something called set returning functions, i.e. a function
that has "RETURNS SETOF" in it's definition.  There's an example in the
docs[1].  To create a view from this example, do

  CREATE VIEW emps AS
    SELECT * FROM get_emps();

The problem with this is that the optimiser can't "see inside" the
function and do much fancy optimisation any more.  I can't help with
your other questions.

> Any advice or counsel would be greatly appreciated.

I'd get everything working separately before trying to bring it all
together.  I.e. get the regressions working in plain R using data
extracted by hand before trying to do everything in PG.


  Sam

-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

Reply via email to