[R] Extracting values from R objects within Perl

Weidong Zhang wzhang at molecularmining.com
Thu Jul 18 23:09:15 CEST 2002


Hi,

I am calling R "integrate" function from within Perl. In R,
integrate(dnorm, -1.96, 1.96)$value returns 0.95, but how can I get this
when I call this function from within Perl?

I am using R-1.5.1, Perl 5.6.0 with RSPerl package installed (Linux).
Here is my program:
########################
use R;
use RReferences;

&R::initR("--gui=none", "--vanilla");
&R::library(RSPerl);

$y1 = -1.96;
$y2 = 1.96;

$inteOutput = &R::callWithNames("integrate", {'', 'dnorm', 'lower', $y1,
'upper', $y2} );

How can I get the value (0.95) from $inteOutput???

Thanks in advance,

Weidong

 
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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