r - 在 OS 10.8.2 上安装 R 库 XLConnect

标签 r excel xlconnect

XLConnect正如手册所描述的那样,“一个允许在 R 中读取、写入和操作 Microsoft Excel 文件的包”。

在 Windows 和 Linux 上的安装非常简单。只需告诉 R install.packages("XLConnect"),即可完成。安装说明显示,在 OS X 上,您需要使用 install.packages("XLConnect", type="source")

在 OS 10.8.2 下尝试此操作,R 输出许多错误消息。我将它们发布在这里,以便 Google 可以向有类似问题的人发送此问答。要找到问题的解决方案,请向下滚动。

<小时/>

R输出:

> install.packages("XLConnect", type = "source")
also installing the dependencies ‘XLConnectJars’, ‘rJava’

versuche URL 'http://ftp5.gwdg.de/pub/misc/cran/src/contrib/XLConnectJars_0.2-4.tar.gz'
Content type 'application/x-gzip' length 16539227 bytes (15.8 Mb)
URL geöffnet
==================================================
downloaded 15.8 Mb

versuche URL 'http://ftp5.gwdg.de/pub/misc/cran/src/contrib/rJava_0.9-3.tar.gz'
Content type 'application/x-gzip' length 537153 bytes (524 Kb)
URL geöffnet
==================================================
downloaded 524 Kb

versuche URL 'http://ftp5.gwdg.de/pub/misc/cran/src/contrib/XLConnect_0.2-4.tar.gz'
Content type 'application/x-gzip' length 1719698 bytes (1.6 Mb)
URL geöffnet
==================================================
downloaded 1.6 Mb

* installing *source* package ‘rJava’ ...
** Paket ‘rJava’ erfolgreich entpackt und MD5 Summen überprüft
/Library/Frameworks/R.framework/Resources/bin/config: line 142: make: command not found
/Library/Frameworks/R.framework/Resources/bin/config: line 143: make: command not found
/Library/Frameworks/R.framework/Resources/bin/config: line 219: make: command not found
/Library/Frameworks/R.framework/Resources/bin/config: line 142: make: command not found
/Library/Frameworks/R.framework/Resources/bin/config: line 143: make: command not found
/Library/Frameworks/R.framework/Resources/bin/config: line 219: make: command not found
checking for gcc... no
checking for cc... no
checking for cl.exe... no
configure: error: no acceptable C compiler found in $PATH
See `config.log' for more details.
ERROR: configuration failed for package ‘rJava’
* removing ‘/Library/Frameworks/R.framework/Versions/2.15/Resources/library/rJava’
ERROR: dependency ‘rJava’ is not available for package ‘XLConnectJars’
* removing ‘/Library/Frameworks/R.framework/Versions/2.15/Resources/library/XLConnectJars’
ERROR: dependencies ‘XLConnectJars’, ‘rJava’ are not available for package ‘XLConnect’
* removing ‘/Library/Frameworks/R.framework/Versions/2.15/Resources/library/XLConnect’

Die heruntergeladenen Quellpakete sind in 
    ‘/private/var/folders/some/path/to/downloaded_packages’
Warnmeldungen:
1: In install.packages("XLConnect", type = "source") :
 Installation des Pakets ‘rJava’ hatte Exit-Status ungleich 0
2: In install.packages("XLConnect", type = "source") :
 Installation des Pakets ‘XLConnectJars’ hatte Exit-Status ungleich 0
3: In install.packages("XLConnect", type = "source") :
 Installation des Pakets ‘XLConnect’ hatte Exit-Status ungleich 0
> library(XLConnect)
Fehler in library(XLConnect) : es gibt kein Paket namens ‘XLConnect’

最佳答案

Mac OSX 上的安装比 installation instructions 稍微复杂一点。建议。该软件包的开发者 Mirai Solutions 的 Martin Studer 帮助我解决了我的困难,我想在这里发布该过程以帮助其他可能遇到相同问题的用户。

  1. 安装 Java
    出于安全考虑,最新版本的 OS X 不包含 Java。如果您从带有 Java 的版本更新,它将被卸载! Check ,如果你有Java。如果没有,download并安装它。
  2. 安装rJava
    您将(稍后)从源代码安装 XLConnect,因为没有适用于 OS X 的二进制文件。在此安装过程中,当 R 尝试安装依赖包 rJava 时,您将收到错误消息,因为它必须从二进制文件安装。所以你必须先安装它,使用
    install.packages("rJava")
  3. 安装 XLConnect
    最后,从源安装 XLConnect:
    install.packages("XLConnect", type="source")

关于r - 在 OS 10.8.2 上安装 R 库 XLConnect,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15303967/

相关文章:

r - 将 R 列表保存为单个元素

c# - 使用 OpenXML 读取 Excel 文件

excel - 隐藏不在数组中的工作表

使用 data.frames 将 Excel 工作簿中的所有工作表读入 R 列表

r - 编辑 Excel 工作表的特定单元格

r - 导入单元格而不会从xlsx中删除

r - 在 R 中处理日期正则表达式捕获组输出

r - .libPaths(blah) 什么都不做

r - 错误 : String must be an atomic vector R

c# - 使用C#创建的excel文件保存时出现冲突,如何关闭提示对话框?