简体   繁体   中英

Reading Access database files in r

I have read an access database containing 6 tables in R. I am using 'sqlFetch' to read the tables one-by-one. Is there a way to read all the tables within the database at once?

I am using

sqlFetch(channel,"table name")

Thanks.

You can do

library(RODBC)
conn <- odbcConnectAccess2007("your_db.mdb")
tabs <- lapply(subset(sqlTables(conn), 
                      TABLE_TYPE == "TABLE", 
                      TABLE_NAME)[, 1], 
               sqlFetch, 
               channel = conn) 
close(conn) 

... and get a list of all tables in tabs .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM