[R] Execute commands in 'R' within PERL Program

chakri_amateur chakri2sai at yahoo.co.in
Mon Jul 5 12:48:04 CEST 2010


Hi,

I wrote a program in PERL which creates a file with .net extension (..
xyz.net). I want to call R from within my PERL program, execute 3-line
command in 'R', store the output and get back to PERL program.

RSPerl is of omegahat is a good software which creates interface between R
and PERL, but unfortunately it doesn't work on my Windows XP.

I used the following command in PERL to call R

@args = ('C:\Program Files\R\R-2.9.0\bin\Rgui.exe');
system(@args) == 0 or die "system @args failed: $!";

which opens R console. 

Now, I want to run the following command in R, close R and get back to
original PERL program

g <- read.graph("f://xyz.net", "pajek")
d<-degree(g,mode="in")
power.law.fit(d+1)

I am struck at this point, could any one help me out ?

In the past, there was a discussion in this forum titled "Problem calling R
from within perl script on Windows
......", from there I picked up the system command to call R from within
PERL. Thanks barrry ! 

I am hoping that somebody from that thread could help me.. ! 

Thanks
Chakri
-- 
View this message in context: http://r.789695.n4.nabble.com/Execute-commands-in-R-within-PERL-Program-tp2278255p2278255.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list