我试图将相当多的数据框保存到多表Excel表格中,并且遇到了一些奇怪的错误。
library(xlsx)
save.xlsx("WorkbookTitle.xlsx", mtcars, Titanic, iris)
save.xlsx <- function (file, ...)
{
require(xlsx, quietly = TRUE)
objects <- list(...)
fargs <- as.list(match.call(expand.dots = TRUE))
objnames <- as.character(fargs)[-c(1, 2)]
nobjects <- length(objects)
for (i in 1:nobjects) {
if (i == 1)
write.xlsx(objects[[i]], file, sheetName = objnames[i])
else write.xlsx(objects[[i]], file, sheetName = objnames[i],
append = TRUE)
}
print(paste("Workbook", file, "has", nobjects, "worksheets."))
}
给了我一个实际的工作簿但是当我尝试用我的数据帧执行此操作时,我收到此错误:
the condition has length > 1 and only the first element will be usedError in .jcall(cell, "V", "setCellValue", value) :
method setCellValue with signature ([Ljava/lang/String;)V not found
我删除了行名,但似乎没有用。