Colleagues,

I have encountered a problem in version 2.9 of R, running in both Vista and OS X. My code is quite lengthy but the critical line is:
        if (file.exists(FILENAME))      readLines(FILENAME))

This triggers the error:
        Error in file(con, "r") : cannot open the connection
        Calls: readLines -> file
        Execution halted

The file that it is reading is being created on the fly, then eventually deleted. The conditional was used to ensure that the readLines command would be executed only when the file existed.

Is it possible that the file is deleted AFTER the conditional is evaluated but before the readLines command is executed? If so, is there any means to prevent an error condition?

Any help will be greatly appreciated.  Thanks.

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

______________________________________________
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