我在while循环中有一个readline函数,它为我提供了选择代码块的选项。循环继续,直到条件改变。 (例如TRUE为FALSE)奇怪的是,下面的代码将迭代大约20次,直到它要求我输入。
option <- readline(prompt=paste("Home team. Needing MLe for 8th. No crossover. Choose three options:
1) MLE from 25-man. 2) Call up someone from outside 25-man.","There is exact inning to fill the inning: ",torf,sep=""))
通过重复以下操作让我的控制台变得丑陋:
Home team. Needing MLe for 8th. No crossover. Choose three options: 1) MLE from 25-man. 2) Call up someone from outside 25-man.There is exact inning to fill the inning: TRUE inning <- ((sample_home$IP[i] %/% 1 + (((sample_home$IP[i] %% 1) * (10/3)))) / 9)
Home team. Needing MLe for 8th. No crossover. Choose three options: 1) MLE from 25-man. 2) Call up someone from outside 25-man.There is exact inning to fill the inning: TRUE
Home team. Needing MLe for 8th. No crossover. Choose three options: 1) MLE from 25-man. 2) Call up someone from outside 25-man.There is exact inning to fill the inning: TRUE ER <- ifelse((blank_home$LW[2] * inning) - (blank_home$LW[3] * inning) - (sample_home$LW[i]) + (4.25 * inning) < 0, 0, ER <- round((blank_home$LW[2] * inning) - (blank_home$LW[3] * inning) - (sample_home$LW[i]) + (4.25 * inning),digits=0))
Home team. Needing MLe for 8th. No crossover. Choose three options: 1) MLE from 25-man. 2) Call up someone from outside 25-man.There is exact inning to fill the inning: TRUE
Home team. Needing MLe for 8th. No crossover. Choose three options: 1) MLE from 25-man. 2) Call up someone from outside 25-man.There is exact inning to fill the inning: TRUE if(ER < 0)
Home team. Needing MLe for 8th. No crossover. Choose three options: 1) MLE from 25-man. 2) Call up someone from outside 25-man.There is exact inning to fill the inning: TRUE {
Home team. Needing MLe for 8th. No crossover. Choose three options: 1) MLE from 25-man. 2) Call up someone from outside 25-man.There is exact inning to fill the inning: TRUE sample_home$ER[i] <- 0
Home team. Needing MLe for 8th. No crossover. Choose three options: 1) MLE from 25-man. 2) Call up someone from outside 25-man.There is exact inning to fill the inning: TRUE
Home team. Needing MLe for 8th. No crossover. Choose three options: 1) MLE from 25-man. 2) Call up someone from outside 25-man.There is exact inning to fill the inning: TRUE }
Home team. Needing MLe for 8th. No crossover. Choose three options: 1) MLE from 25-man. 2) Call up someone from outside 25-man.There is exact inning to fill the inning: TRUE
Home team. Needing MLe for 8th. No crossover. Choose three options: 1) MLE from 25-man. 2) Call up someone from outside 25-man.There is exact inning to fill the inning: TRUE if(ER >= 0)
Home team. Needing MLe for 8th. No crossover. Choose three options: 1) MLE from 25-man. 2) Call up someone from outside 25-man.There is exact inning to fill the inning: TRUE {
Home team. Needing MLe for 8th. No crossover. Choose three options: 1) MLE from 25-man. 2) Call up someone from outside 25-man.There is exact inning to fill the inning: TRUE sample_home$ER[i] <- ER
Home team. Needing MLe for 8th. No crossover. Choose three options: 1) MLE from 25-man. 2) Call up someone from outside 25-man.There is exact inning to fill the inning: TRUE
Home team. Needing MLe for 8th. No crossover. Choose three options: 1) MLE from 25-man. 2) Call up someone from outside 25-man.There is exact inning to fill the inning: TRUE }
Home team. Needing MLe for 8th. No crossover. Choose three options: 1) MLE from 25-man. 2) Call up someone from outside 25-man.There is exact inning to fill the inning: TRUE
Home team. Needing MLe for 8th. No crossover. Choose three options: 1) MLE from 25-man. 2) Call up someone from outside 25-man.There is exact inning to fill the inning: TRUE }
Home team. Needing MLe for 8th. No crossover. Choose three options: 1) MLE from 25-man. 2) Call up someone from outside 25-man.There is exact inning to fill the inning: TRUE
Home team. Needing MLe for 8th. No crossover. Choose three options: 1) MLE from 25-man. 2) Call up someone from outside 25-man.There is exact inning to fill the inning: TRUE name <- as.character(sample_home$PlayerName)
Home team. Needing MLe for 8th. No crossover. Choose three options: 1) MLE from 25-man. 2) Call up someone from outside 25-man.There is exact inning to fill the inning: TRUE
Home team. Needing MLe for 8th. No crossover. Choose three options: 1) MLE from 25-man. 2) Call up someone from outside 25-man.There is exact inning to fill the inning: TRUE for(i in 1:length(name))
Home team. Needing MLe for 8th...
在readline作为输入后,它似乎占用了代码行。我该如何防止这种情况发生?