[英]Attempting the create multiple sheets in an excel workbook using R but recieving error after a few
I have about 30 or so R outputs that each go in their own sheets of the same file. 我大约有30个左右的R输出,每个输出都放在同一个文件的各自工作表中。 However after about 7 or 8, I recieve this error sporadically.
但是大约7或8后,我偶尔会收到此错误。
Error: POIXMLException (Java): java.lang.reflect.InvocationTargetException
library(readxl)
library(dplyr)
library(formattable)
options(java.parameters = "-Xmx1024m")
library(XLConnectJars)
library(XLConnect)
writeWorksheetToFile("CDFI_NACA.xlsx",
data = iris,
sheet = "Iris Dataset",
header = TRUE,
clearSheets = TRUE)
So the above will be repeated in different ways about 30 times, yet around 7 or 8 entries, I receive the error, sporadically all for different types of outputs. 因此,以上内容将以不同的方式重复执行大约30次,但是大约7或8个条目,我会收到错误消息,偶尔会出现不同类型的输出。
You can use openxlsx
. 您可以使用
openxlsx
。 It does not depend on java. 它不依赖于Java。 You can even write all 30 dataframes in a single shot.
您甚至可以一次写入所有30个数据帧。
library(openxlsx)
df_list = list(FIRST=df1, SECOND=df2, THIRD=df3) #list of data frames with name
write.xlsx(df_list, "output.xlsx", overwrite=T) #list element name will become the sheetname.
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.