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

前端 未结 8 1127
夕颜
夕颜 2020-12-16 14:05

The RODBC documentation suggests it is possible, but I am not sure how to read data from a Microsoft Access (the new .accdb format) file with this package into

8条回答
  •  攒了一身酷
    2020-12-16 14:28

    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
    

提交回复
热议问题