| [reply] |
You can open a pipe to that process:
open my $x, "|-", "R" or die "Can't launch R: $!";
pritn $x $your_data;
If you also need to capture STDOUT, IPC::Open2 or IPC::Open3 might what you want. | [reply] [d/l] |
hi,
Thanks for the code.
I tried opening a pipe to the R.exe program, and then attempted to write to it using:
my $program = "C:\\Program\ Files\\R\\R-2.7.1\\bin\\R.exe";
open my $x, "|-", "$program" or die "Can't launch R: $!";
$your_data="hello";
print $x $your_data;
I obtained an error:
Fatal error: you must specify '--save', '--no-save' or '--vanilla'
I also tried the above code replacing the R.exe with the Rgui.exe. Although I didn't receive an error, I didn't obtain the output to the Rgui window. Further, using this option, perl doesn't continue past the point where the program is called (this is probably why I receive no error). I would like to be able to call the program, send some commands to it, obtain its output and then terminate the program.
Could you please suggest where I can modify my code to make this work?
Thanks!
Al
| [reply] |
I obtained an error: Fatal error: you must specify '--save', '--no-save' or '--vanilla'
So did you specify any of these options to R.exe? what was the result?
First learn how to use your programs from the command line, and when you got that try to automate that with perl.
| [reply] [d/l] |
| [reply] |