0

I use this option to save the data into an excel file

 write.xlsx(df, 'C:/Users/User/Desktop/mydata.xlsx')

However I receive this error:

Error in stri_conv(v[flg], from = "", to = "UTF-8") : 
  memory allocation error

What can I do to fix it?

Erik Bodg
  • 302
  • 2
  • 10
  • It sounds like there may be some troublesome characters which it's trying and failing to convert into the UTF-8 character set. Perhaps relevant: https://stackoverflow.com/questions/52299696/encoding-issue-with-write-xlsx-openxlsx or https://community.rstudio.com/t/error-when-trying-to-export-a-data-frame-to-xlsx-file-using-write-xlsx-function-in-openxlsx-package/37533 – Jon Spring Apr 15 '21 at 23:25
  • You might try rerunning it with a subset of `df`, eg `write.xlsx(df[1:10,], 'C:/Users/User/Desktop/mydata.xlsx')` to see if you can identify which ranges of data make it stop working. If it doesn't work on any of your data, it should be particularly simple to share an excerpt of that, eg by sharing the output of `dput(df[1:2,])` to produce code for us to generate a perfect copy of your first two rows. – Jon Spring Apr 15 '21 at 23:38

0 Answers0