我确实需要将每个循环结果保存在EXCEL文件中,我的代码如下:
library(xlsx)
library(bootstrap)
rawData <- read.xlsx("C:\\Users\\Taqwa\\Downloads\\9660.xlsx",1)
#load<-function(AveLd,AveOff,AveOn,DWELL_SEC)
# + + sum((AveLd-AveOff)+AveOn)
#bootstrap(rawData,10000,load())
three_d_array <- array(0,dim = c(270, 6, 20))
for (i in 1:20){
candy = 1:nrow(rawData)
B=sample(candy,nrow(rawData) , replace=T)
a=rawData[B,]
three_d_array[,,i]=as.matrix(a)
}
赞赏你的帮助
答案 0 :(得分:0)
,放:
out <- createWorkbook()
循环内部:
assign(paste0("sheet", i), createSheet(wb = out, sheetName = as.character(i)))
# you don't really need your three_d_array
addDataFrame(x = a, sheet = eval(as.name(paste0("sheet", i))))
循环后:
saveWorkbook(out, "[your path]/[file name].xlsx")