我使用了两种方法。
readxl::read_excel
将我的文件读入R时,我无法在所有计算后使用xlsx::write.xlsx
将其导出为Excel。加载包装后,显示:
library(xlsx)
# Loading required package: rJava
# Loading required package: xlsxjars
# Error : .onLoad failed in loadNamespace() for 'xlsx', details:
# call: .jinit()
# error: Cannot create Java virtual machine (-4)
# Error: package or namespace load failed for ‘xlsx’
当我尝试XLConnect
时,它显示了类似的内容:
# library(XLConnect)
# Loading required package: XLConnectJars
# Error : .onLoad failed in loadNamespace() for 'XLConnectJars', details:
# call: .jinit()
# error: Cannot create Java virtual machine (-1)
# Error: package ‘XLConnectJars’ could not be loaded
Error: std::bad_alloc
我该如何纠正这个?