Re: Using PL/R for predictive analysis of data.

From: Sam Mason <sam(at)samason(dot)me(dot)uk>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Using PL/R for predictive analysis of data.
Date: 2008-03-14 18:19:36
Message-ID: 20080314181936.GZ1653@frubble.xen.chris-lamb.co.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Wed, Mar 12, 2008 at 09:35:24AM -0700, Mr(dot)Frog(dot)to(dot)you(at)googlemail(dot)com 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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Scott Marlowe 2008-03-14 18:20:57 Re: postgre vs MySQL
Previous Message Dean Gibson (DB Administrator) 2008-03-14 18:18:12 Re: Can't rename an existnig DB because it doesn't exist???