mdb_get: Read in an mdb file.

Description Usage Arguments Details Value

View source: R/mdb-get.R

Description

A shortened, simplified version of Hmisc::mdb.get

Usage

1
mdb_get(file, tables = NULL, mdbexportArgs = "", ...)

Arguments

file

mdb file to read. You may need to surround the name in quotes, like '"file name.mdb"'.

tables

either a list or vector of table names; tables = TRUE to import a list of tables; or the default which means import all tables

mdbexportArgs

arguments to pass to mdb-export. See details for some examples, and man mdb-export for a comprehensive discussion of all possible terminal arguments.

...

arguments passed to readr::read_csv.

Details

Still uses mdbtools internally (so that needs to be installed). On Ubuntu, use sudo apt get install mdbtools.

The process is to use mdbtools to convert the mdb table into a csv file, then use readr::read_csv to read the csv file in quickly.

You will commonly want to use mdbexportArgs = '-D%m/%d/%Y' to get the dates right. m means month, d means day, and Y means 4-digit year (note that y would mean 2 digit year). Without explicitly stating this, mdb-export will commonly export as m/d/y format instead, which makes it impossible to tell e.g. 1910 from 2010.

you may also be interested in the common idiom, col_types = cols(.default = col_character()), which tells read_csv to read in all columns as characters. This is guaranteed to avoid parsing failures at the read_csv step.

Value

if only 1 table is read, a tibble. Otherwise, a list of tibbles containing all the tables read in.


rdisalv2/dismisc documentation built on March 19, 2018, 9:12 a.m.