title: if command to test for integer(0)
body: <p>I'm using a command to return the points at which participants reach 8 contiguous responses in a row. The command is:</p>
  
  <pre><code> test &lt;- which( rle(goo)$values==1 &amp; rle(goo)$lengths &gt;= 8)
  </code></pre>
  
  <p>where:</p>
  
  <pre><code> goo &lt;- c(1, 1, 1, 0, 0, 0, 0, 0, 1, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0)
  </code></pre>
  
  <p>if the participant never achieves 8 contiguous responses i'd like to set the variable "test" to equal -1. As it stands, the command returns integer(0) when 8 contiguous responses in a row are not found. I've tried writing an if command but can't seem to get it right. </p>
  
  <p>Thanks in advance,</p>
  
  <p>Will</p>