R语言_包的安装_xlsx

xlsx是一个用于导入和导出xlsx数据的R包。

安装方法:

先选择一个中国区的镜像(如果一个下载不了就换一个),然后安装:

install.packages("xlsx")

加载包:

library(xlsx)

发现报错:

错误: package or namespace load failed for ‘xlsx’:
 loadNamespace()里算'rJava'时.onLoad失败了,详细内容:
  调用: fun(libname, pkgname)
  错误: JAVA_HOME cannot be determined from the Registry

解决方法:

  1. 度娘说需要在电脑安装Java,所以去官网下载最新版并安装。依旧没有解决问题。
  2. 在help搜索rJava,阅读description file(如下文所示),发现缺乏“Java JDK 1.2 or higher ”。官网下载并安装。加载成功,问题解决,。PS:在另外一台电脑重试,发现不用第一步,直接安装Java JDK即可
Package: rJava
Version: 0.9-12
Title: Low-Level R to Java Interface
Author: Simon Urbanek 
Maintainer: Simon Urbanek 
Depends: R (>= 2.5.0), methods
Description: Low-level interface to Java VM very much like .C/.Call and friends. Allows creation of objects, calling methods and accessing fields.
License: GPL-2
URL: http://www.rforge.net/rJava/
SystemRequirements: Java JDK 1.2 or higher (for JRI/REngine JDK 1.4 or
        higher), GNU make
BugReports: https://github.com/s-u/rJava/issues
NeedsCompilation: yes
Packaged: 2020-03-22 23:38:59 UTC; surb939
Repository: CRAN
Date/Publication: 2020-03-24 09:10:05 UTC
Built: R 4.0.0; i386-w64-mingw32; 2020-04-26 13:23:39 UTC; windows
Archs: i386, x64

你可能感兴趣的:(R语言,r语言)