R Studio安装xlsx包

时间:2015-11-06 23:40:34

标签: r

我尝试使用R Studio安装xlsx软件包但我遇到了一些问题。当安装过程开始时,我被问到问题" Package只能以源代码形式提供,并且可能需要编译C / C ++ / Fortran:'rJava'你想尝试从源代码安装这些吗?&# 34;我回复了#34; y"。

程序然后继续下载3 .tar.gz文件。我复制了下面的完整代码。

问题是,我不确定下一步要完成安装需要做什么?任何帮助是极大的赞赏。

> install.packages("xlsx")
also installing the dependencies ‘rJava’, ‘xlsxjars’

Package which is only available in source form, and may need compilation of                C/C++/Fortran:
‘rJava’
Do you want to attempt to install these from sources?
y/n: y
installing the source packages ‘rJava’, ‘xlsxjars’, ‘xlsx’

trying URL 'https://cran.rstudio.com/src/contrib/rJava_0.9-7.tar.gz'
Content type 'application/x-gzip' length 711181 bytes (694 KB)
downloaded 694 KB

trying URL 'https://cran.rstudio.com/src/contrib/xlsxjars_0.6.1.tar.gz'
Content type 'application/x-gzip' length 9477071 bytes (9.0 MB)
downloaded 9.0 MB

trying URL 'https://cran.rstudio.com/src/contrib/xlsx_0.5.7.tar.gz'
Content type 'application/x-gzip' length 312839 bytes (305 KB)
downloaded 305 KB

* installing *source* package 'rJava' ...
** package 'rJava' successfully unpacked and MD5 sums checked
Generate Windows-specific files (src/jvm-w32) ...
make: Entering directory        `/cygdrive/c/Users/davish/AppData/Local/Temp/RtmpmOuT4w/R.INSTALL456448961b13/rJ    ava/src/jvm-w32'
dlltool --as as -m i386:x86-64 --as-flags --64 --input-def jvm64.def --kill-     at --dllname jvm.dll --output-lib libjvm.dll.a
gcc -m64 -O2 -c -o findjava.o findjava.c
gcc -m64 -s -o findjava.exe findjava.o
make: Leaving directory    `/cygdrive/c/Users/davish/AppData/Local/Temp/RtmpmOuT4w/R.INSTALL456448961b13/rJ    ava/src/jvm-w32'
Find Java...
ERROR*> JavaSoft\{JRE|JDK} can't open registry keys.
ERROR: cannot find Java Development Kit.
   Please set JAVA_HOME to specify its location manually
Warning: running command 'sh ./configure.win' had status 1
ERROR: configuration failed for package 'rJava'
* removing 'C:/Program Files/R/R-3.2.2/library/rJava'
Warning in install.packages :
running command '"C:/PROGRA~1/R/R-32~1.2/bin/x64/R" CMD INSTALL -l      "C:\Program Files\R\R-3.2.2\library"      C:\Users\davish\AppData\Local\Temp\Rtmp2FwjgL/downloaded_packages/rJava_0.9-    7.tar.gz' had status 1
Warning in install.packages :
installation of package ‘rJava’ had non-zero exit status
ERROR: dependency 'rJava' is not available for package 'xlsxjars'
* removing 'C:/Program Files/R/R-3.2.2/library/xlsxjars'
Warning in install.packages :
running command '"C:/PROGRA~1/R/R-32~1.2/bin/x64/R" CMD INSTALL -l    "C:\Program Files\R\R-3.2.2\library"    C:\Users\davish\AppData\Local\Temp\Rtmp2FwjgL/downloaded_packages/xlsxjars_0.6.1 .tar.gz' had status 1
Warning in install.packages :
installation of package ‘xlsxjars’ had non-zero exit status
ERROR: dependencies 'rJava', 'xlsxjars' are not available for package 'xlsx'
* removing 'C:/Program Files/R/R-3.2.2/library/xlsx'
Warning in install.packages :
running command '"C:/PROGRA~1/R/R-32~1.2/bin/x64/R" CMD INSTALL -l   "C:\Program Files\R\R-3.2.2\library"   C:\Users\davish\AppData\Local\Temp\Rtmp2FwjgL/downloaded_packages/xlsx_0.5.7.tar    .gz' had status 1
Warning in install.packages :
installation of package ‘xlsx’ had non-zero exit status

The downloaded source packages are in
‘C:\Users\davish\AppData\Local\Temp\Rtmp2FwjgL\downloaded_packages’

1 个答案:

答案 0 :(得分:1)

请查看错误:

ERROR*> JavaSoft\{JRE|JDK} can't open registry keys.
ERROR: cannot find Java Development Kit.
   Please set JAVA_HOME to specify its location manually

解决方案:安装jdk