0

I try to write a df to an existing excel file by using write.xlsx(df, filename.xlsx, sheetName=123, append=TRUE). After run the code two times, R studio encountered a fatal error, and I have to uninstall Rsudio and reinstall it. But I still have the same problem after re-installation.

If I write the df to a new excel file by write.xlsx(df, name.xlsx, sheetName = 123, col.names = TRUE), the code will be totally fine. No such problem ever.

Anyone can tell me how to solve this problem? I appreciate!

zx8754
  • 52,746
  • 12
  • 114
  • 209
futong
  • 33
  • 4
  • What library do you use? Is your dataframe big enough to crash RStudio, or it is small? Have you tried to give Java more memory? – Alex Knorre Jun 06 '17 at 15:52
  • @AlexeyKnorre Iuse library(xlsx) – futong Jun 06 '17 at 16:28
  • `xlsx` is (r)java-dependent and it causes a lot of headache with heap space etc. In my experience it's always better to use Java-independent libraries (`readxl` for reading, `openxlsx` for writing). Try `openxlsx` library, it seems much more reliable, think it will solve your problem. – Alex Knorre Jun 06 '17 at 17:04
  • @AlexeyKnorre Thank you! Will try! – futong Jun 06 '17 at 17:16
  • @AlexeyKnorre Now I have this new problem, https://github.com/awalker89/openxlsx/issues/76. Have you ever had the same problem. – futong Jun 06 '17 at 17:31
  • Yep. The problem is that openxlsx needs zip archiver, which is bundled with RTools. To install the latter, do this: `install.packages("installr")` `installr::install.rtools()` That should do. – Alex Knorre Jun 06 '17 at 17:45

0 Answers0