mdb.get: Read Tables in a Microsoft Access Database

View source: R/mdb.get.s

mdb.getR Documentation

Read Tables in a Microsoft Access Database


Assuming the mdbtools package has been installed on your system and is in the system path, mdb.get imports one or more tables in a Microsoft Access database. Date-time variables are converted to dates or chron package date-time variables. The csv.get function is used to import automatically exported csv files. If tables is unspecified all tables in the database are retrieved. If more than one table is imported, the result is a list of data frames.


mdb.get(file, tables=NULL, lowernames=FALSE, allow=NULL,
        dateformat='%m/%d/%y', mdbexportArgs='-b strip', ...)



the file name containing the Access database


character vector specifying the names of tables to import. Default is to import all tables. Specify tables=TRUE to return the list of available tables.


set this to TRUE to change variable names to lower case


a vector of characters allowed by R that should not be converted to periods in variable names. By default, underscores in variable names are converted to periods as with R before version 1.9.


see cleanup.import. Default is the usual Access format used in the U.S.


command line arguments to issue to mdb-export. Set to '' to omit '-b strip'.


arguments to pass to csv.get


Uses the mdbtools package executables mdb-tables, mdb-schema, and mdb-export (with by default option -b strip to drop any binary output). In Debian/Ubuntu Linux run apt get install mdbtools. cleanup.import is invoked by csv.get to transform variables and store them as efficiently as possible.


a new data frame or a list of data frames


Frank Harrell, Vanderbilt University

See Also

data.frame, cleanup.import, csv.get, Date, chron


## Not run: 
# Read all tables in the Microsoft Access database Nwind.mdb
d <- mdb.get('Nwind.mdb')
for(z in d) print(contents(z))
# Just print the names of tables in the database
mdb.get('Nwind.mdb', tables=TRUE)
# Import one table
Orders <- mdb.get('Nwind.mdb', tables='Orders')

## End(Not run)

harrelfe/Hmisc documentation built on May 19, 2024, 4:13 a.m.