title: Adding elements to a list in for loop in R
body: <p>I'm trying to add elements to a list in a for loop. How can I set the field name?</p>
  <pre><code>L &lt;- list() 
      for(i in 1:N)
      {
          # Create object Ps...
          string &lt;- paste(&quot;element&quot;, i, sep=&quot;&quot;)
          L$get(string) &lt;- Ps
      }
  </code></pre>
  <p>I want every element of the list to have the field name dependent from i (for example, the second element should have &quot;element2&quot;)</p>
  <p>How to do this? I think that my error is the usage of <code>get</code></p>