title: Error in while : missing value where TRUE/FALSE needed
body: <p>I am new in R and I am stuck in a silly error.. Although I found some questions that tackle my problem I can't solve it.  </p>
  
  <pre><code>ww &lt;- waveMC_list[[5]]
  sampling=44100
  thresh=10
  
  timer.output &lt;- timer(ww, f=sampling, threshold=thresh,envt="abs",ksmooth=kernel("daniell",100))
  
  
  i=0
  min.length=0.05                    # minimum length of segment
  segmts=length(timer.output[[4]])   # total amount of segments to evaluate
  segments &lt;- list()                 # output of valid segments
  starts=timer.output[[4]]           # starting times
  ends=timer.output[[5]]             # ending times
  
  
  
  for(i in 1:segmts)
  {
    if(i &lt;= segmts)
    {
    while(starts[i] &lt;= ends[i]) #print(TRUE)
      {
      if((ends[i]-starts[i])&gt;min.length)
        {
         segments[[i]] &lt;- env(WaveMC(cutw(ww, f=44100, from= starts[i], to=ends[i],plot=F), bit= 16, samp.rate=44100)
                              , f=44100, ksmooth=kernel("daniell",90),plot=F)
         print(paste('check', i, sep=' '))
         print(segmts)
            #env("ACAWAVEFILE", f=44100, ksmooth=kernel("daniell",90)) 
        }   
         i=i+1
      }
    }
  }
  
  Error in while (starts[i] &lt;= ends[i]) { : 
  </code></pre>
  
  <p>missing value where TRUE/FALSE needed</p>