On Sun, 11 Feb 2001, Brian Ingerson wrote:
> I played with R last night too. The demos were amazing. I'm definitely a
> proponent of gluing this thing to Perl. Not only would it be good for R,
> but it I think it could help Perl see more action in academia and the
> sciences.
That's already happened, you're just not in academia or the sciences like
I am, so you don't know about it ;)
I've been interacting with a number of people on the R mailing list
regarding this stuff. Someone has already embedded a Perl interpreter
within the R environment, so that you can execute your perl scripts (and
have the results available) via R. It's a toss up which is "better" -
both are interpreted languages written in C.
> 3) Provide translation between simple data types. (It seems like R
> variables should always translate to Perl array refs.)
There are a few other "commonly used" data types in R/S. The first is a
"data frame" which is a recordset holder. The second is "lists" (which I
personally don't understand as being any different then the usual R array,
but they behave differently in R functions). The results of various
functions will come back with object attributes.
In speaking with some of the R people, we have two options: use
the nitty-gritty C API to translate data types, or use "R_eval" to simply
"type" the data into R. I expect things will become more clear as I delve
deeper.
> PS Here's a sample that calls a math 'gamma' function from R. At least
> it's a place to start.
Oh sure, you can use Inline::C to write C (which calls the R library), but
I want to use Inline::R to write R.
-Aaron
>
> ----8<----
> use Inline C => DATA =>
> LIBS => '-L/usr/local/lib/R/bin -lR',
> INC => "-I/usr/local/lib/R/include/",
> PREFIX => 'my_';
>
> print dgamma(1, 2, 3, 4), "\n";
>
> __END__
> __C__
> #include "Rmath.h"
>
> double my_dgamma(double a, double b, double c, int i) {
> return dgamma(a, b, c, i);
> }
> ----8<----