[R] reading non-existing files

Dave Evens devens8765 at yahoo.com
Tue Jun 7 18:48:27 CEST 2005

Dear all,

I'm trying to read to a collection of files in a loop
using odbcConnectExcel - but not all of the files
exist. This is the code I have

for(i in 1:no.of.subs){
   channel <- odbcConnectExcel(paste(working.dir,
subs[i], ".xls", sep=""))
   datafiles[[i]] <- as.matrix(sqlFetch(channel,

I'm not sure how to alter the code to allow for the
fact that some files may not exist - these files
should be ignored.

Currently, I get the following error

Error in odbcTableExists(channel, sqtable) : 
        'Data': table not found on channel

- it however creates an empty file for the first
occurance of a non-existing file then stops.

I would very much apprepriate any help.

Thanks in advance.



Get on-the-go sports scores, stock quotes, news and more. Check it out!

More information about the R-help mailing list