[R] Testing for the existence of a file.
Kurt Hornik
Kurt.Hornik at ci.tuwien.ac.at
Fri Nov 2 08:33:24 CET 2001
>>>>> Rolf Turner writes:
> 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.
Use file.exists() to find out whether a file exists.
-k
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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