加载 xlsx 包时出错 [英] Error loading xlsx package

查看:71
本文介绍了加载 xlsx 包时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

昨天我们迁移到我们公司的 Windows 7 并更新了 java 包和 R(到 2.14).

yesterday we migrated to windows 7 in our firm and also updated the java packages and also R (to 2.14).

然后我尝试加载 xlsx 包,因为我非常依赖它,但出现以下错误:

Then I tried to load the xlsx package, because I rely heavly on it but i get the following error:

Error : .onAttach in attachNamespace()
Error: .jnew("org/apache/poi/xssf/usermodel/XSSFWorkbook")

我尝试了以下方法,但没有奏效:

I tried the following, but it did not work:

Sys.setenv(PATH=paste(Sys.getenv("PATH"),"C:\\Program Files (x86)\\Java\\jre6\\bin\\client",collapse=';')) 
options(java.parameters = "-Xmx1000m")

因为我从不使用 Java,所以我不知道我能做什么.你能帮助我吗?

Since I never work with java i have no clue what I can do. Can you help me?

谢谢!

会话信息()R 版本 2.14.1 (2011-12-22)平台:i386-pc-mingw32/i386(32位)

sessionInfo() R version 2.14.1 (2011-12-22) Platform: i386-pc-mingw32/i386 (32-bit)

地区:[1] LC_COLLATE=German_Austria.1252 LC_CTYPE=German_Austria.1252
[3] LC_MONETARY=German_Austria.1252 LC_NUMERIC=C
[5] LC_TIME=German_Austria.1252

locale: [1] LC_COLLATE=German_Austria.1252 LC_CTYPE=German_Austria.1252
[3] LC_MONETARY=German_Austria.1252 LC_NUMERIC=C
[5] LC_TIME=German_Austria.1252

附加基础包:[1] stats 图形 grDevices utils datasets 方法基础

attached base packages: [1] stats graphics grDevices utils datasets methods base

其他附加包:[1] xlsxjars_0.4.0 rJava_0.9-3

other attached packages: [1] xlsxjars_0.4.0 rJava_0.9-3

通过命名空间加载(且未附加):[1] 工具_2.14.1 xlsx_0.4.2

loaded via a namespace (and not attached): [1] tools_2.14.1 xlsx_0.4.2

<小时>

有趣的是,XLConnect 包加载没有问题.好的,它加载没有问题,但加载工作簿不起作用:


The interesting thing is, that the package XLConnect loads without problems. Ok, it loads without problems but loading a workbook does not work:

Error: NoSuchMethodError (Java): org.apache.xmlbeans.XmlOptions.setSaveAggressiveNamespaces()Lorg/apache/xmlbeans/XmlOptions;

所以也许这真的不是 Java 问题.但我不想将我所有的代码都重写到 XLConnect!

So maybe it is really no Java problem. But I don't want to re-write all my code to XLConnect!

没人知道我可以尝试什么吗?

Nobody any ideas what I could try?

推荐答案

我遇到了完全相同的错误并找到了解决方法.如果您指定网络上的库位置来安装包,则会发生错误.

I encountered exactly the same error and found a work-around. If you specify a library location on the network to install the package into, the error occurs.

## Example where error occurs: 
install.packages('xlsx', lib='\\network\R\library')
library('xlsx', lib='\\network\R\library'))

但是,如果您在 R 中更改包安装的默认位置,那么您应该能够调用包库而不会出错.也就是说,只需键入 install.packages('xlsx'),然后让包自动安装到其默认位置,就可以让包正常工作.

However, if you change the default location for package installation within R, then you should be able to call the package library without the error. That is, simply typing install.packages('xlsx'), and having the package install automatically to its default location, allowed the package to work properly.

这篇关于加载 xlsx 包时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆