Forum OpenACS Q&A: Embedding R in Postgress
and let me know if it is possible to do in TCL.
Any comments are welcome.
Are you trying to integrate statistical language R in OpenACS environment ?
You may want to ask if anyone has picked up Long's work on the R database special interest group mailing list. The list has almost no traffic, but some very high-powered R people (e.g., Brian D. Ripley) do subscribe and respond.
Also, back in October 2001, Roberto and Don pointed out that Long was probably mistaken in believing that R needs to be thread safe when embedded inside Postgres - it doesn't. On the other hand, if you instead wanted to embed R inside AOLserver, like others have done for Python, Java, Standard ML, and Perl, then it would need to be thread-safe.
If you can get R working reliably (perhaps it does already - I don't know) in either Postgres or AOLserver, or both, then you'll be able to use it nicely in an OpenACS environment. Once you do that, there's nothing particularly special about OpenACS that would either prevent or help you from using R however you want.
If your needs are simpler, you can always simply spawn R processes from Tcl (or perhaps even as CGI scripts). I haven't tried that with R (yet), but I've seen it done with S-Plus. S-Plus makes this slightly annoying because you have to do a bunch of setting of environemnt variables and stuff to play nice with S-Plus's "workspaces", but it's definitely practical if you just need to run some S calculations from Tcl.
By the way, Ulka, what sort of uses to you expect to put R to in your OpenACS environment? I'm curious...
This is similar to but different than Duncan Lang's earier work Embedding R in Postgres. In addition to the Postgres hackers email above, Joe also had this to add about PL/R:
You might say it was inspired by Duncan's work, but not really related/derived from it. He approached the problem from a very "R centric" point of view, and I from a very "PostgreSQL centric" point of view (not surprising given our respective backgrounds). PL/R does however rely on R's ability to be embedded as a shared library, and I believe Duncan was the primary driver of that (based on what I've found browsing around).
Another triumph for free/open source software.
set x [nsR log1p 1.5] set x [nsR expml 2] set x [nsR gamma 10]
Btw, what did you do about thread safety? Last I heard I thought R was not thread-safe, but maybe it is now?