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">
The xlsx package gives programatic control of Excel files using R. A high level API allows the user to read a sheet of an xlsx document into a data. frame and write a data.
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).
Try to use write.xlsx
from openxlsx
package that does not use java.
openxlsx::write.xlsx(x = dataframe, file = "dataframe.xlsx")
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With