I try to save some R-dataframes into .xlsx-files using the write.xlsx
function of the xlsx
package like this
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
> 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.
When you work in Eclipse, you can start R using either rj
- a Java terminal, or RTerm
- the native R terminal.
If you are using the rj
terminal and something doesn't work, try the same thing with RTerm
.
I have never tried to figure out why, but a few things don't work properly in rj
. This includes all use of RCOM
as well as printing of the return value of system()
.
I use rj
by default because I like the way it deals with help (amongst other benefits).
But if things don't work, I try it in RTerm
. One day I'll have some spare time and I'll take it up with the author.
PS. I want to stress that I absolutely love StatET in Eclipse. These oddities or rj
are very minor inconveniences in the grand scheme of things.