0

我正在尝试通过 install_github 在 R 中安装 r2excel 包,但出现此错误

> install_github("kassambara/r2excel")

控制台中出现几行,我得到

* installing *source* package 'r2excel' ...
** R
** preparing package for lazy loading
Warning: package 'xlsx' was built under R version 3.4.4
** help
*** installing help indices
  converting help for package 'r2excel'
    finding HTML links ... done
    getOS                                   html  
    r2excel-package                         html  
    xlsx.addHeader                          html  
    xlsx.addHyperlink                       html  
    xlsx.addLineBreak                       html  
    xlsx.addParagraph                       html  
    xlsx.addPlot                            html  
    xlsx.addTable                           html  
    xlsx.openFile                           html  
    xlsx.readFile                           html  
    xlsx.writeFile                          html  
    xlsx.writeMultipleData                  html  
** building package indices
** testing if installed package can be loaded
*** arch - i386
Warning: package 'xlsx' was built under R version 3.4.4
Error: package or namespace load failed for 'xlsx':
 .onLoad failed in loadNamespace() for 'rJava', details:
  call: fun(libname, pkgname)
  error: No CurrentVersion entry in Software/JavaSoft registry! Try re-    installing Java and make sure R and Java have matching architectures.
Error : package 'xlsx' could not be loaded
Error: loading failed
Execution halted
*** arch - x64
Warning: package 'xlsx' was built under R version 3.4.4
ERROR: loading failed for 'i386'
* removing 'C:/Users/myusername/Documents/R/win-library/3.4/r2excel'
In R CMD INSTALL
Installation failed: Command failed (1)        

所以我在“xlsx”加载时收到这个错误
奇怪的是我没有问题单独加载“xlsx”和“rJava”

library(xlsx)

我安装了 x64 java(构建 1.8.0_161-b12)和运行 x64 rStudio,所以我真的不知道问题出在哪里。

4

1 回答 1

0

根据 liuyanguu 在https://github.com/kassambara/r2excel/issues/6

“这个包不是在 64 位系统中构建的,所以我们不能这样安装。但是你仍然可以通过克隆 repo 和源或复制粘贴“/R/r2excel.r”来使用所有功能。实际上没有需要安装包。”

于 2020-04-09T08:55:48.853 回答