title: for loop to output different objects in r
body: <p>I am trying to use for to create multiple objects from for, just example (not exact): </p>
  
  <pre><code>l_gr &lt;- list (1:10, 11:20, 21:30)
  for (i in 1:length(l_gr)){
    grp &lt;- NULL
    grp[[i]] &lt;- mean(l_gr[[i]])
      }
  </code></pre>
  
  <p>This is not what I am expecting, rather I need to output multiple objects (of different class) however the name is different with i level for example: here grp1, grp2, grp3.
  Each of these object has output of the function for particular i list. Sorry for simple question. </p>
  
  <p>Edits: response to provide specific example: </p>
  
  <pre><code>install.packages("onemap")
  require(onemap)
  data(example.out)
  twopts &lt;- rf.2pts(example.out)
  all.data &lt;- make.seq(twopts,"all") 
  link_gr &lt;- group(all.data)
  link_gr$n.groups
  </code></pre>
  
  <p>starts the loop</p>
  
  <pre><code>  # without loop: 
  # for 1
  grp1 &lt;- make.seq(link_gr, 1)
  grp1.od &lt;- order.seq(input.seq=grp1, n.init = 5,  subset.search = "twopt", 
      twopt.alg = "rcd", THRES = 3, draw.try = TRUE, wait = 1, touchdown=TRUE) 
  
  
  # for 2
  grp2 &lt;- make.seq(link_gr, 2)
  grp2.od &lt;- order.seq(input.seq=grp2, n.init = 5,  subset.search = "twopt",  
     twopt.alg = "rcd", THRES = 3, draw.try = TRUE, wait = 1, touchdown=TRUE) 
  </code></pre>
  
  <p>same process report for 1:1:link_gr$n.groups </p>
  
  <p>So I want create a for loop and output objects:</p>
  
  <pre><code>for (i in 1:link_gr$n.groups){
      grp &lt;- NULL
    grp[i] &lt;- make.seq(link_gr, i)
    grp[i].od &lt;- order.seq(input.seq=grp[i], n.init = 5,  subset.search = "twopt",  
        twopt.alg = "rcd", THRES = 3, draw.try = TRUE, wait = 1, touchdown=TRUE)
      } 
  </code></pre>