1
xlen <- 50 # Length
xGRU <- seq(1, 2723, by = xlen) # Start ID
xjob <- 36 # Numbe of Jobs per Joblist
# List of all run Commands
runcommands <- paste("TESTTHIS", xGRU, xlen , '-r d', '-m', sep=" ")
runcommands <- append(head(runcommands, -1),
paste("TESTTHIS", tail(xGRU,1), 11723%%xlen ,
'-r d', '-m', sep=" "))
for(i in seq(1, length(runcommands), by = xjob)){
jobfileName <- paste0('data_raw/joblist_', i, ".txt")
cat(paste(runcommands[i:(i+xjob-1)]), file=jobfileName, append=TRUE, sep = "\n")
}
但是最後創建的文件有NAs
。如何確保在索引用完時for loop
不會寫出NA?如何在索引用完時使循環不能通過NA?