简体   繁体   English

尝试使用R编写xlsx文件时出现错误消息

[英]Error message when trying to write a xlsx.-file with R

I try to save some R-dataframes into .xlsx-files using the write.xlsx function of the xlsx package like this 我试图像这样使用xlsx包的write.xlsx函数将一些R数据帧保存到.xlsx文件中

write.xlsx(tab,file="test",sheetName="testsheet",col.names=TRUE,row.names=FALSE,append=FALSE)

whereas the object tab is a data frame, as prooved here 而对象tab是数据框,如此处所示

> class(tab)
[1] "data.frame"

When I run the code I get the following error message 当我运行代码时,出现以下错误信息

>  write.xlsx(tab,file="test.xlsx",sheetName="testsheet",col.names=TRUE,row.names=FALSE,append=FALSE)
Fehler in .jcall("RJavaTools", "Z", "hasField", .jcast(x, "java/lang/Object"),  : 
  RcallMethod: cannot determine object class

and I have no particular idea what the problem could be. 我不知道可能是什么问题。

PS: I'm running R 2.14.1 in the StatET 2.0 plugin in Eclipse 3.7 on a 64bit machine. PS:我在64位计算机上的Eclipse 3.7的StatET 2.0插件中运行R 2.14.1。

From my experience these kind of errors are produced when the standard rj package is installed instead of the one supplied bij the StatET developer. 根据我的经验,当安装标准rj软件包而不是StatET开发人员提供的软件包时,会产生此类错误。 Check the installation guide here: http://www.walware.de/goto/statet 在此处查看安装指南: http : //www.walware.de/goto/statet

If you would happen to be using Debian or Ubuntu, you can also use the repository from OpenAnalytics to install StatET and the correct rj packages in one go. 如果您碰巧正在使用Debian或Ubuntu,则还可以使用OpenAnalytics中的存储库一次性安装StatET和正确的rj软件包。

http://deb.openanalytics.eu/howto.html http://deb.openanalytics.eu/howto.html

When you work in Eclipse, you can start R using either rj - a Java terminal, or RTerm - the native R terminal. 在Eclipse中工作时,可以使用rj (Java终端)或RTerm (本机R终端)启动R。

If you are using the rj terminal and something doesn't work, try the same thing with RTerm . 如果您正在使用rj终端,但是某些方法不起作用,请使用RTerm尝试相同的RTerm

I have never tried to figure out why, but a few things don't work properly in rj . 我从未尝试找出原因,但是在rj有些事情无法正常工作。 This includes all use of RCOM as well as printing of the return value of system() . 这包括对RCOM所有使用以及对system()返回值的打印。

I use rj by default because I like the way it deals with help (amongst other benefits). 我默认使用rj ,因为我喜欢它处理帮助的方式(还有其他好处)。
But if things don't work, I try it in RTerm . 但是,如果事情不起作用,我可以在RTerm尝试一下。 One day I'll have some spare time and I'll take it up with the author. 有一天,我将有一些业余时间,我将和作者一起度过。


PS. PS。 I want to stress that I absolutely love StatET in Eclipse. 我想强调一点,就是我绝对喜欢Eclipse中的StatET。 These oddities or rj are very minor inconveniences in the grand scheme of things. 这些奇数或rj在事物的总体方案中是非常小的麻烦。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM