[R] reading non-existing files

From: Dave Evens <devens8765_at_yahoo.com>
Date: Wed 08 Jun 2005 - 02:48:27 EST

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, "Data"))

   close(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

I would very much apprepriate any help.

Thanks in advance.

Dave                 


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



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Wed Jun 08 02:52:48 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:32:27 EST