首页 > 解决方案 > 循环中断时间

问题描述

我正在使用 Kim Tsao ( http://www.kimtsao.com/Kim_Tsao/Code/Entries/2011/9/30_Reflections_on_the_lake_files/tRFLP_id.r ) 发布的代码进行片段分析。我正在尝试将最后的代码块写入循环,而不是手动运行每个示例的代码。但是,在打印“样本列表结束”后,我无法让循​​环正确中断

x <- 0 
repeat {
     x <- x+1 
     if (x<= length(samplelist)){
         samplelist[x]
         output = matchSample(x, weightby=c("Height","AreaInPoint"),threshold=4) 

         if (nrow(output)>1){graphOutput(output)} else {print(samplelist[x]);print(output)}
     } else { print("End of sample list.")}
     if (print("End of sample list.")){
         break
     }

标签: repeat

解决方案


推荐阅读