[R] Rlanguage plr and loadiing climatol package

David Potts dave.potts at pinan.co.uk
Mon Nov 22 08:27:18 CET 2010


Thank to everybody that helped.

I have a working bit of code :-)
>
> On Nov 20, 2010, at 3:25 PM, David Potts wrote:
>
>>
>> Hi List
>>
>> I am trying to call the R library function rosavent from the climatol
>> package via the plr interface package to the postgres database.
>>
>> My code is a follows
>>
>> create or replace function w_graph() returns text as
>> '
>> str <- pg.spi.exec("select
>> n,nne,ne,ene,e,ese,se,sse,s,ssw,sw,wsw,w,wnw,nw,nnw from wdata");
>> pdf("/tmp/foobar.pdf");
>> rosavent(str,4,4,ang=-3*pi/16,main="Annual windrose")
>>
>> dev.off();
>> print("Done");
>> '
>> LANGUAGE plr;
>>
>> When invoked it gives the error
>>
>> # select w_graph();
>> ERROR:  R interpreter expression evaluation error
>> DETAIL:  Error in PLR7843132 <- function() { : could not find function
>> "rosavent"
>> CONTEXT:  In PL/R function w_graph
>>
>> I assume this means it can not find the rosavent function from the
>> climatol package.
>>
>> I have loaded the climatol package using the following syntax
>> install.packages("climatol",lib="/home/dfuncs/r-lang/my-rlib")
>
> I'm not sure if not having loaded climatol is the source of your
> problem, but if it is, you have forgotten to load the package after
> installing it. Perhaps:
>
> require(climatol)   # before the pdf(...) call
>
>>
>> I assume that the an R process created by the plr interface will
>> load a
>> library, does any body know how I tell it to load it?
>>
>
> This page:
> http://www.varlena.com/GeneralBits/Tidbits/bernier/art13mar04/graphingWithR.html
>
>   makes me thing that PL/R passes r code pg.spi.exec (... calls. Does
> it matter that the illustration on that page uses str<<- pg.spi.exec
> ( rahter than str<- ?
>
> (This would seem to be the wrong place to be asking these questions.
> There are websites set up to mediate conversations between PL/R users.)
> --
>
> David Winsemius, MD
> West Hartford, CT
>


xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Any views expressed in this message are those of the individual sender,
except where the sender specifically states them to be the views of the
Pinan Software



More information about the R-help mailing list