Dear Alberto, channel <- odbcConnectExcel("test.xls") name1 <- tables[1, "TABLE_NAME"] # the name1 is Sheet1$ it must be: name1 <- "Sheet1" plan1 <- sqlFetch(channel, name1) is ok or plan1 <- sqlFetch(channel, "Sheet1")
Regards, Felipe -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Alberto Monteiro Sent: Tuesday, March 06, 2007 9:37 AM To: r-help@stat.math.ethz.ch Subject: [R] Package RODBC I have some questions about the RODBC package. library(RODBC) # required for those who want to repeat these lines 1st, I noticed that the following sequence does not work: channel <- odbcConnextExcel("test.xls") tables <- sqlTables(channel) name1 <- tables[1, "TABLE_NAME"] # this should be the name plan1 <- sqlFetch(channel, name1) # bang! odbcClose(channel) However, I can circumvent this with: channel <- odbcConnextExcel("test.xls") tables <- sqlTables(channel) name1 <- tables[1, "TABLE_NAME"] # this should be the name plan1 <- sqlQuery(channel, sprintf("select * from [%s]", name1)) # ok odbcClose(channel) 2nd, it seems that only "pure" strings (which are not links to strings) and numerical values are correctly fetched or selected. Is this a bug? 3rd, when do something like plan1[,1] a weird message about Levels appear. What is that? Alberto Monteiro ______________________________________________ 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 and provide commented, minimal, self-contained, reproducible code. ______________________________________________ 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 and provide commented, minimal, self-contained, reproducible code.