title: R - I don't know why my code won't run?
body: <p>Here is my code</p>
  
  <pre><code>for(j in 1:423){
  for(i in 1:18){
  kh[j,i+1] &lt;- kh[j,i] + kh[j,i+1]
  if(kh[j,i+1]&gt;kh$median[j]){break}}print(i+1)}
  </code></pre>
  
  <p>I don't know why this code won't work, yet this code works well:</p>
  
  <pre><code>for(i in 1:18){
  kh[1,i+1] &lt;- kh[1,i] + kh[1,i+1]
  if(kh[1,i+1]&gt;kh$median[1]){break}}
  print(i+1) 
  </code></pre>
  
  <p>I want to result about every J's (from 1 to 423)
  Please help me ! </p>