[R] PL/R article

Joe Conway mail at joeconway.com
Wed Mar 24 04:02:56 CET 2004


Douglas Bates wrote:
> Interesting article.  Thanks for bringing it to our attention, Joe.
> 
> There are a couple of quotes that I like, such as "It's simply amazing
> the things that you can learn when data is presented in a graphical
> format." 
> 
> It appears that the author is using <<- when he only needs <- in one
> function definition.  There isn't anything peculiar about PL/R that
> would require <<-, is there?

No, nothing at all.

The only time you might need <<- (and I'm admittedly no expert on R, so 
this may be inappropriate use), is when you want to create a variable in 
one PL/R function, and then access it from another PL/R function. For 
instance, when you want to prepare a query, and then execute it multiple 
times. By preparing the query, you save the time of parsing and planning 
each time you execute it. There is an example here (see pg.spi.execp):
http://www.joeconway.com/plr/doc/plr-spi-rsupport-funcs.html

In Robert's example he's calling pg.spi.exec directly, so there is no 
need for <<-.

Thanks for the comments!

Joe




More information about the R-help mailing list