title: Negative subscripts error in R
body: <p>I have the following code snippet:</p>
  
  <pre><code>if(k&lt;=100 &amp;&amp; k&gt;=0 )
  {        
      j[k+seq(-50,150)]&lt;-F;
  }
  else
  {
      j[k+seq(-100,100)]&lt;-F;
  }
  </code></pre>
  
  <p>And the following error:</p>
  
  <blockquote>
    <p>Error in j[k + seq(-50, 150)] &lt;- F :   only 0's may be mixed with negative subscripts</p>
  </blockquote>
  
  <p>Why am I getting this even though I have set the conditions if the subscripts may
  run into the negative values?</p>