[R] passing lists through .C

Catherine Loader catherine at research.bell-labs.com
Wed Dec 12 04:26:04 CET 2001


I have a list,

> rb
$t
[1] "tree"
 
$x
[1] 0
 
$cut
[1] 0.8
 
$l
 [1] 0 0
 
and pass it through .C("fn",rb) to

void fn(ev)
int **ev;
{ double cut;
  cut = *(double *)ev[2][0];
  printf("%8.5f\n",cut);
}

in S-4, it produces 0.8, as I want.
But R (version 1.3.1, linux) produces a segmentation fault.
Is it possible to access list elements in R? The manual seems
to suggest writing .Call interfaces, which I want to avoid.

Thanks,
Catherine.
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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