Mac下R语言xlsx包报错问题解决

> library(xlsx)

错误: package or namespace load failed for ‘xlsx’:  loadNamespace()里算'rJava'时.onLoad失败了,详细内容:   调用: dyn.load(file, DLLpath = DLLpath, ...)   错误: 无法载入共享目标对象‘/Library/Frameworks/R.framework/Versions/3.6/Resources/library/rJava/libs/rJava.so’::   dlopen(/Library/Frameworks/R.framework/Versions/3.6/Resources/library/rJava/libs/rJava.so, 6): Library not loaded: /Library/Java/JavaVirtualMachines/jdk-11.0.1.jdk/Contents/Home/lib/server/libjvm.dylib   Referenced from: /Library/Frameworks/R.framework/Versions/3.6/Resources/library/rJava/libs/rJava.so   Reason: image not found

解决方案:

因为mac上配java环境复杂,所以不使用xlsx包,用openxlsx代替,即

> install.packages("openxlsx")

> library(openxlsx)

 

你可能感兴趣的:(R)