[R] scan errors

Prof Brian Ripley ripley at stats.ox.ac.uk
Wed Aug 18 14:40:59 CEST 1999

> Date: Wed, 18 Aug 1999 13:51:42 +0200
> From: Carlos Corral van Damme <cfcorral at gmv.es>
> X-Accept-Language: es

[I hope you accept en too.]

> Is there any way to ignore the error produced when the function
> scan(file="...") cannot open the file (due to, e.g., the file does not
> exist)?

Use file.exists to check the file exists. If you need more information,
you can use system calls, but they will be OS-specific. On Unix,
a call via system() to `test' normally can tell you all you need.
On Windows, you can call attrib.

You can also use restart to catch the error (needs 0.65; which says

     Use of this code is very likely to result in an infin-
     ite loop. It should be avoided at all costs and is
     included in R for compatibility with S. The soon to
     appear R exception handling should remove all need for
     such a function.

`soon to appear' means at least 0.66 as it has missed the
feature-freeze on 0.65, so don't wait for it.)

> I am also very interested in ways to label a contour plot.

Label the contours?  So are we all!  Last time I asked (several months
ago) it was Real Soon Now (TM).

Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272860 (secr)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

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