[R] scan errors

Brahm, David David.Brahm at fmr.com
Wed Aug 18 16:04:41 CEST 1999

> Is there any way to ignore the error produced when the function
scan(file="...") cannot open the file

In S, on a Unix machine, I would say
  if (.exists(file)) scan(file)
where the ".exists()" function is defined as follows:
  .exists <- function(file) unix(paste("test -r", file, "; echo $?"))=="0"

 -- David Brahm
    Fidelity Investments

r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch

More information about the R-help mailing list