As a newbie to RODBC (Windows XP), I find that the commands aren't
working quite as expected.
After
Library(RODBC)

I had planned to use the two-step process

myConn = odbcConnectExcel("Dates.xls")
sqlQuery(myConn,"SELECT ID, ADM_DATE, ADM_TIME FROM A") #A is the Excel
spreadsheet name
X = sqlGetResults(myConn, as.is=c(T,T,F))
#2 char variables and 1 integer
odbcClose(myConn)

This doesn't work.  Instead the following works:

myConn = odbcConnectExcel("Dates.xls")
X=sqlQuery(myConn,"SELECT ID, ADM_DATE, ADM_TIME FROM A",
as.is=c(T,T,F))
odbcClose(myConn)


> class(X)
[1] "data.frame"
> class(X$ID)
[1] "character"
> class(X[,2])
[1] "character"
> class(X[,3])
[1] "integer"


I thought sqlQuery stored a query that was to be processed by
sqlGetResults.  What's happening here?

Joe

______________________________________________
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.

Reply via email to