How to read data from Microsoft Access .accdb database files into R?

ODBC is a bit of 'plug and pray' system connecting different bricks.

RODBC allow you to get something from an ODBC provider into R. What you still need is the (for lack of a better word) ODBC-exporting driver of the database system in question. Which you need on your OS --- so I think with the Access-into-Linux combination you are without luck. Windows-only.

People have managed to access SQL Server using FreeTDS drivers (for the TDS protocol underlying Sybase and via an early license also MS-SQL) but it is usualluy a fight to get it going.


The title of the page you linked, RODBC: ODBC Database Access, may be misleading. Access doesn't mean MS Access; in that title access means connectivity. RODBC is an ODBC manager for R. It serves as the mediator to provide communication between R and the ODBC driver for your target database. So for GNU/Linux, you would still need an ODBC driver for MS Access database files ... RODBC doesn't provide one.

However, I don't know of any free (as in freedom and/or beer) MS Access ODBC drivers for Linux. Easysoft sells one, but it's not cheap. There may be offerings from other vendors, too; I haven't looked.

It might be easier to use a Windows machine to export your ACCDB to a format R can use. Or run R on Windows instead of Linux.


To import a post-2007 Microsoft Access file (.accdb) into R, you can use the RODBC package.

For an .accdb file called "foo.accdb" with the following tables, "bar" and "bin", stored on the desktop of John Doe's computer:

library(RODBC)    #loads the RODBC package
dta <- odbcConnectAccess2007("C:/Users/JohnDoe/Desktop/foo.accdb")   #specifies the file path
df1 <- sqlFetch(dta, "bar")   #loads the table called 'bar' in the original Access file
df2 <- sqlFetch(dta, "bin")   #loads the table called 'bin' in the original Access file