正如手册所描述的, XLConnect是“一个允许从 R 中读取、写入和操作 Microsoft Excel 文件的包”。
在 Windows 和 Linux 上的安装非常简单。只需告诉 R install.packages("XLConnect")
,你就完成了。在 OS X 上你需要使用install.packages("XLConnect", type="source")
,安装说明说。
在 OS 10.8.2 下尝试此操作,R 输出许多错误消息。我将它们发布在这里,以便 Google 可以将有类似问题的人发送到此 Q 和 A。有关问题的解决方案,请向下滚动。
输出:
> 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’