[R] Testing for the existence of a file.

Rolf Turner rolf at maths.uwa.edu.au
Fri Nov 2 05:27:27 CET 2001


Is there any way to do this (test for the existence of a file)
in R?  In Splus (3.4) I can do

        unix(paste("test -r", fnm), output = F)

where ``fnm'' is a character string giving the pathname of the file.

This returns 0 if the file exists and 256 if it doesn't.

I thought in R to do something like

        system(paste("test -r", fnm), intern =T)

but this returns ``character(0)'' irrespective of the existence of
the file.

Any ideas?

					cheers,

						Rolf Turner
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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