[R] reading non-existent files

Christian.Stratowa@vie.boehringer-ingelheim.com Christian.Stratowa at vie.boehringer-ingelheim.com
Tue Jan 28 16:29:03 CET 2003


Dear All

Thank you all for your fast help, the solutions that I have received are:
file.exists()
try()
allFiles<-list.files(mydir)

Best regards
Christian Stratowa

==============================================
Christian Stratowa, PhD
Boehringer Ingelheim Austria
Dept NCE Lead Discovery - Bioinformatics
Dr. Boehringergasse 5-11
A-1121 Vienna, Austria
Tel.: ++43-1-80105-2470
Fax: ++43-1-80105-2683
email: christian.stratowa at vie.boehringer-ingelheim.com

> -----Original Message-----
> From:	ripley at stats.ox.ac.uk [SMTP:ripley at stats.ox.ac.uk]
> Sent:	Tuesday, January 28, 2003 4:20 PM
> To:	Stratowa,Dr,Christian   FEX BIG-AT-V
> Cc:	r-help at stat.math.ethz.ch
> Subject:	Re: [R] reading non-existent files
> 
> On Tue, 28 Jan 2003 Christian.Stratowa at vie.boehringer-ingelheim.com wrote:
> 
> > I would like to read all files from a directory, the files have names
> > "myname0001.txt" etc. I paste the directory plus file names and
> > use "read.delim()".
> > My problem is that some file names are missing, so I get an error
> > and my program stops.
> 
> How can some of `all files from a directory' be missing?  Why not read 
> them via e.g. list.files()?
> 
> > Is there a way to check for a null pointer analogous to C, so that
> > I can simply skip non-existent filenames?
> 
> ?file.exists
> 
> -- 
> 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 272866 (PA)
> Oxford OX1 3TG, UK                Fax:  +44 1865 272595
>




More information about the R-help mailing list