[R] Catching R's (D)COM output in perl

Stefan Etschberger Stefan.Etschberger at wiwi.uni-augsburg.de
Thu Jun 24 15:12:36 CEST 2004


Hi,

i'm using Perl to control R under Windows via the Win32::OLE module and 
R's (D)COM server. This works fine, if i send commands and/or simple 
data structures to R. I am also able to get matrix-shaped return values 
into my Perl program, like this

# snip ----------------------------------------------------
my $R = Win32::OLE->new('StatConnectorSrv.StatConnector');
$R->Init('R');
my $matrix = $R->Evaluate('matrix(c(1,"a",2,"b",3,"c"),2,3)');
# ---------------------------------------------------- snap

What i did not achieve is to catch ALL the output from R which goes 
normally to the console window.

# this won't collect R's summary formatting as a string ------
my $summary = $R->Evaluate('summary(c(1,2,3))');
# ------------------------------------------------------------

I guess i have to figure out how to use the '"console" device (Active X 
control)',
and maybe use $R->SetCharacterOutputDevice() in Perl but i was neither 
getting this to work nor was i able to find the right spot containing 
this information.

Does someone have a clue?

Thanks in advance,

Stefan
----------------
Stefan Etschberger
Institut für Statistik und Mathematische Wirtschaftstheorie
Universität Augsburg
D-86135 Augsburg


	
	


	
	


	stefan.etschberger at wiwi.uni-augsburg.de 
<mailto:stefan.etschberger at wiwi.uni-augsburg.de>




More information about the R-help mailing list