Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Access data base import to R-installation of mdb tools on Mac

The plan ist to import an Access database into R to filter out what I need to make statistical analysis. A colleague suggested me the following code:

library(Hmisc)
d <- mdb.get('140410_db_vegBY1.mdb')
#(data under #https://www.dropbox.com/sh/ra588lailweynrq/AACRVqMKWtd9Zz7fa94O9CAUa)

# ERROR: sh: mdb-tables: command not found
# Fehler in system(paste("mdb-tables -1", file), intern = TRUE) : 
#  Fehler bei der Ausführung des Kommandos

After my search I started to install mdb tools on my mac OS X 10.9.2 following this link: http://automatthew.wordpress.com/2008/06/23/how-to-compile-mdbtools-on-mac-os-x-10-4-and-10-5/#comment-124 But it didn't work but the thread seems to be inactive. Can somebody help me?

like image 834
user3514704 Avatar asked May 09 '14 15:05

user3514704


1 Answers

The following steps worked for me.

  1. Install the Hmisc package for R.
  2. Install mdbtools version 0.7.1 by homebrew: brew install mdbtools.
  3. Use mdb.get() function in the Hmisc package to read .mdb files into R:

    library(Hmisc)
    df <- mdb.get('file.mdb')
    

Here is my setup and package versions:

> sessionInfo()
R version 3.2.2 (2015-08-14)
Platform: x86_64-apple-darwin13.4.0 (64-bit)
Running under: OS X 10.11.1 (El Capitan)

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
[1] grid      stats     graphics  grDevices utils     datasets  methods  
[8] base     

other attached packages:
[1] Hmisc_3.17-0    ggplot2_1.0.1   Formula_1.2-1   survival_2.38-3
[5] lattice_0.20-33

I should mention that I first tried to install mdbtools from source to no avail. I suspect that it was because some dependencies were not installed. See https://github.com/brianb/mdbtools for more information on the dependencies.

like image 115
Paul Avatar answered Nov 19 '22 00:11

Paul