Skip to content
Prev 110880 / 398498 Next

Generating R plots through Perl - Solution

Hello,

I tried what you suggested (i.e. combine the separate plot creation
commands into one command from Perl to R), and it worked.  The syntax is
as follows:

$R->send(qq (xVal <- c(1,2,3,4,5,6)));
$R->send(qq (yVal <- c(3,5,2,6,1,5)));
$R->send(qq (c(pdf("C:/Test Environment/R/perlPlotTest.pdf"), plot(xVal,
yVal), dev.off())));

I appreciate your help with this, and I will look into ruby and the "r
for ruby" project for future use.

Thanks again,
Ryan


-----Original Message-----
From: Charilaos Skiadas [mailto:skiadas at hanover.edu] 
Sent: Thursday, March 01, 2007 6:15 PM
To: Huckstorf, Ryan
Cc: r-help at stat.math.ethz.ch
Subject: Re: [R] Generating R plots through Perl
On Mar 1, 2007, at 6:28 PM, <Ryan.G.Huckstorf at wellsfargo.com> wrote:
First off, if you are working in perl you might want to be aware of ruby
and the "r for ruby" project:
http://rubyforge.org/projects/r4ruby/
I don't really know how to write this in perl, but could you perhaps put
the last three lines all in one call to "$R->send", using dev.off
() then? Don't know if it would make a difference, but that's the only
thing I could think of. I'm guessing something like this:

$R->send(qq (pdf("C:/Test Environment/R/perlPlotTest.pdf"); plot (xVal,
yVal); dev.off()));
Haris Skiadas
Department of Mathematics and Computer Science
Hanover College