title: whats wrong with this R loop function?
body: <p>I am trying to run a loop function like this:</p>
  
  <pre><code>x &lt;- c(1,2,3,4,7,8,9,10,13,14,15,16,19,20,22,23,24,26) 
  n&lt;-rep(NA,length(x))
  for (ii in 1:length(x)){
    n[ii]&lt;-subset(dat1, Plot==ii)
  }
  </code></pre>
  
  <p>However, error message appeared:</p>
  
  <pre><code>There were 18 warnings (use warnings() to see them)
  </code></pre>
  
  <p>The outputs that I am looking for is 18 individual data n1,n2,n3,n4,n7,...n24&amp;n26 subset from main data <code>dat1</code>.</p>