【问题标题】:Access data base import to R-installation of mdb tools on MacAccess 数据库导入到 Mac 上 mdb 工具的 R 安装
【发布时间】:2014-06-27 10:43:13
【问题描述】:

计划是将 Access 数据库导入 R 以过滤出我需要进行统计分析的内容。 一位同事向我推荐了以下代码:

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

搜索后,我开始按照以下链接在我的 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 但它没有用,但线程似乎处于非活动状态。 有人可以帮帮我吗?

【问题讨论】:

    标签: r macos import mdbtools


    【解决方案1】:

    以下步骤对我有用。

    1. 为 R 安装 Hmisc 包。
    2. 安装mdbtools版本0.7.1homebrew:brew install mdbtools
    3. 使用Hmisc包中的mdb.get()函数将.mdb文件读入R:

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

    这是我的设置和软件包版本:

    > 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
    

    我应该提一下,我首先尝试从源代码安装mdbtools,但无济于事。我怀疑这是因为没有安装一些依赖项。有关依赖项的更多信息,请参阅https://github.com/brianb/mdbtools

    【讨论】:

    • 这也适用于 Linux。只需通过系统包管理器安装 mdbtools。例如sudo apt-get install mdbtools 然后使用mdb.get
    猜你喜欢
    • 2012-06-09
    • 2011-03-15
    • 2010-10-03
    • 2017-02-19
    • 2012-02-22
    • 1970-01-01
    • 1970-01-01
    • 2011-05-05
    • 1970-01-01
    相关资源
    最近更新 更多