Important Notice !!!

This blog has been discarded and no update any more.

Please visit http://www.quantlego.com for active updates.

Sorry for any inconvenience.





Sunday, July 14, 2013

Import date from Excel spreadsheet into R using RODBC package

| |
Package RODBC can be used not only for ODBC database connectivity, but also for importing Excel spreadsheet data into R, as shown in following R code:
library(RODBC)
data=odbcConnectExcel(file.choose())
mydata=sqlFetch(data,"Sheet1")
odbcClose(data)
mydata
Here, the odbcConnectExcel establishes a connection to an external Excel spreadsheet.

Note:
  • Function 'odbcConnectExcel' is only usable with 32-bit R. Under Eclipse IDE under 64-bit Windows, you need to activate 32-bit R console in order to run above code.
  • It is said 'odbcConnectExcel2007' works for 64-bit environment, but I had no luck to make it works.

0 comments:

Post a Comment

Powered by Blogger.