简体   繁体   中英

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?

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.

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