Colleagues,

I am using R 2.7.2 on all three platforms (OS X; Windows; Linux) and I  
have encountered the following problem:

I use R to issue a system call the execute a command in the OS.  For  
example:

system("DOSOMETHING TOSOMEFILE")

In most situations, this task completes successfully and control  
returns to R.  However, in rare situations, the target file  
(TOSOMEFILE) is missing an EOL character in its final line.  In that  
situation, the task DOSOMETHING hangs and control never returns to R.   
Exiting R requires that I kill the process.

I believe that a solution would be to add an EOL character to the  
final line of the target file before executing DOSOMETHING.  I presume  
that this could be done by reading TOSOMEFILE with readLines,  
appending an EOL character, writing to disk, then executing TOSOMEFILE  
on the revised target.

Questions:

1.  Is there are easier approach to the entire problem?

2.  Is there any risk in having two EOL characters at the end of the  
file (i.e., need I test for the presence of EOL at the end of the file  
or can I append EOL to any file with no potential harm?

Dennis


Dennis Fisher MD
P < (The "P Less Than" Company)
Phone: 1-866-PLessThan (1-866-753-7784)
Fax: 1-415-564-2220
www.PLessThan.com


        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to