Reputation: 679
I was trying to write a dataframe with 523370 rows and 3 columns using write.xlsx
write.xlsx(x = dataframe, file = "dataframe.xlsx",
+ sheetName = "dataframe1", row.names = FALSE)
but I get this error :
Error in .jnew("org/apache/poi/xssf/usermodel/XSSFWorkbook") :
Java Exception <no description because toString() failed>.jnew("org/apache/poi/xssf/usermodel/XSSFWorkbook")<S4 object of class "jobjRef">
and I check these question :
xlcFreeMemory()
and then try to write the file but after a rather long time I get the same errorwrite.xlsx2()
gave me the same error,after running this one : options(java.parameters = "-Xmx1024m")
and rebooting the systemBut that changed the error changed to:
Error in .jcheck(silent = FALSE) :Java Exception <no description because toString() failed>.jcall(row[[ir]], "Lorg/apache/poi/ss/usermodel/Cell;", "createCell", as.integer(colIndex[ic] - 1))<S4 object of class "jobjRef">
Upvotes: 11
Views: 27792
Reputation: 21
Use this line :
openxlsx::write.xlsx(x = dataframe, file = "dataframe.xlsx")
It worked for me ...
Upvotes: 2
Reputation: 1498
Try to use write.xlsx
from openxlsx
package that does not use java.
openxlsx::write.xlsx(x = dataframe, file = "dataframe.xlsx")
Upvotes: 15
Reputation: 119
I had a similar problem and used write.csv() instead and then saved the csv file as .xlsx from excel. That did the trick.
Upvotes: -3
Reputation: 31
I get the same error when I use the relative path. You can try to use the absolute paths.
Upvotes: 0
Reputation: 824
I had the same problem and restarting R
did the trick.
If you're using RStudio
the keystroke shortcut for restarting R is Ctrl + Shift + F10 (PC) or Command + Shift + F10 (Mac).
Upvotes: 18
Reputation: 1
You can always use read.csv()
and then just save it and a xlsx file if the problem continues.
Upvotes: -4