简体   繁体   English

访问数据库导入到Mac上的m-db工具的R安装

[英]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. 该计划是将Access数据库导入R以过滤掉进行统计分析所需的内容。 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. 在我搜索之后,我开始在我的mac OS X 10.9.2上安装mdb工具,链接如下: http//automatthew.wordpress.com/2008/06/23/how-to-compile-mdbtools-on-mac-os -x-10-4-and-10-5 /#comment-124但它没有用,但线程似乎不活跃。 Can somebody help me? 有人能帮助我吗?

The following steps worked for me. 以下步骤对我有用。

  1. Install the Hmisc package for R. 为R安装Hmisc
  2. Install mdbtools version 0.7.1 by homebrew : brew install mdbtools . 通过homebrew安装mdbtools版本0.7.1brew install mdbtools
  3. Use mdb.get() function in the Hmisc package to read .mdb files into R: 使用Hmisc包中的mdb.get()函数将.mdb文件读入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. 我应该提一下,我首先尝试从源代码安装mdbtools无济于事。 I suspect that it was because some dependencies were not installed. 我怀疑是因为没有安装某些依赖项。 See https://github.com/brianb/mdbtools for more information on the dependencies. 有关依赖项的更多信息,请参阅https://github.com/brianb/mdbtools

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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