[R] Package RODBC

Alberto Monteiro albmont at centroin.com.br
Tue Mar 6 15:36:35 CET 2007


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



More information about the R-help mailing list