[R] problem in loop using windows executable

Pedro Segurado psegurado at isa.ulisboa.pt
Wed Oct 29 18:20:13 CET 2014


Dear all,

I am trying to develop a R script that basically uses a loop that includes 5
main steps: (1) it runs a windows executable file outside R that requires a
set of *.txt files using the shell function (Note: I have tried system and
system(shhQuote()) and the problem remains), (2) it imports the output txt
file of the executable, (3) it deletes the existing input txt files from the
windows folder, (4) it uses values of the imported output file to help
producing new tables to be used as input files to the executable and (5) it
exports those tables in txt format to the windows folder.

Now the problem. I am running this script in a laptop. I have change the
energy saving settings to the highest performance possible, it no energy
saving options at all. If I move the mouse frequently there is no problem,
the whole process is not interrupted. However, if I do not move the mouse,
the process stops (not always in the same loop and the same file) with the
following error:

Error in file(file, ifelse(append, "a", "w")) : 
  cannot open the connection
In addition: Warning message:
In file(file, ifelse(append, "a", "w")) :
  cannot open file 'nodes_29.txt': Permission denied

The file "nodes_29.txt" is one of the executable input files that is
produced in the loop, which can have the same name as previous txt files
that were meanwhile deleted in previous loops (again, please note that the
error is not always in the same loop number and the same file). 

Any idea?

Thanks!
Pedro



More information about the R-help mailing list