in reply to in Statistics::R, startR breaks open

Not really set up to do any testing (and haven't looked at the module), but I wondered whether choosing different filehandles might make a difference - ie instead of specifying FH each time, specify FH1, FH2, FH3, etc.

Cheers,
Rob

Replies are listed 'Best First'.
Re^2: in Statistics::R, startR breaks open
by untitled (Initiate) on Aug 19, 2009 at 15:04 UTC
    Thank you for your response. You are right that if I needed to use the file, different filehandles would be useful. However, unique filehandles aren't essential, and this problem persists with unique filehandles.
      Ok, it looks like startR changes the relative file path. So
      ... $R->startR; open FH, ">", "c:/scripts/test2.txt" or die $!; ...
      works fine (for me, the relative path goes to the directory "C:/Program Files/R/R-2.8.1/Statistics-R/"). I think relative path issues are discussed elsewhere. My workaround is:
      #!/usr/bin/perl use warnings; use strict; use Cwd; use Statistics::R; my $currentdir = cwd(); my $R = Statistics::R->new(); open FH, ">", "test1.txt" or die $!; $R->startR; $R->stopR; chdir($currentdir); open FH, ">", "test2.txt" or die $!;
      Note: I didn't actually need to open a file while communicating with R, but that wouldn't be hard to do. Thank you again.