用r的xlsx包出现java.lang.OutOfMemoryError: GC overhead limit exceeded怎么办

用xlsx包写出数据时遇到了如下的报错

Error in .jnew("org/apache/poi/xssf/usermodel/XSSFWorkbook") : 
  java.lang.OutOfMemoryError: GC overhead limit exceeded

第一种处理方法,提高Java的运行内存

options(java.parameters = "-Xmx4096m")

如果第一种方法不行,我们可以用openxlsx包,代码如下

require(openxlsx)
list_of_datasets <- list("Name of DataSheet1" = dataframe1, "Name of Datasheet2" = dataframe2)
write.xlsx(list_of_datasets, file = "writeXLSX2.xlsx"

参考资料: https://stackoverflow.com/questions/27713310/easy-way-to-export-multiple-data-frame-to-multiple-excel-worksheets

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

友情链接更多精彩内容