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

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.
  • Comment on Re^2: in Statistics::R, startR breaks open

Replies are listed 'Best First'.
Re^3: in Statistics::R, startR breaks open
by untitled (Initiate) on Aug 19, 2009 at 18:36 UTC
    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.