[R] passing lists through .C
Martin Maechler
maechler at stat.math.ethz.ch
Wed Dec 12 09:19:59 CET 2001
>>>>> "CL" == Catherine Loader <catherine at research.bell-labs.com> writes:
CL> I have a list,
>> rb
CL> $t [1] "tree"
CL> $x [1] 0
CL> $cut [1] 0.8
CL> $l [1] 0 0
CL> and pass it through .C("fn",rb) to
CL> void fn(ev)
CL> int **ev;
CL> { double cut;
CL> cut = *(double *)ev[2][0];
CL> printf("%8.5f\n",cut);
CL> }
CL> in S-4, it produces 0.8, as I want.
which is astonishing, and AFAIK not at all to be relied on.
CL> But R (version 1.3.1, linux) produces a segmentation fault.
CL> Is it possible to access list elements in R?
yes, via .Call()
CL> The manual seems to suggest writing .Call
CL> interfaces, which I want to avoid.
no way (to avoid this)!
It's also the (only?) way publicized for S4 (based versions of
S-PLUS).
Regards,
Martin
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
More information about the R-help
mailing list