title: Problems using double lists
body: <p>I'm having trouble trying to implement a double list in R. If one sublist is initialized with just one element then after I tried to add more elements I get the error message:</p>
  
  <blockquote>
    <p>more elements supplied than there are to replace</p>
  </blockquote>
  
  <p>Here is an example:</p>
  
  <pre><code>#
  # This is OK
  #
  a &lt;- list()
  a[["elem1"]][["elem2"]] &lt;- c(10,20)
  a[["elem1"]][["elem2"]] &lt;- c(a[["elem1"]][["elem2"]], c(30,40))
  </code></pre>
  
  <p>And this is the output of a:</p>
  
  <pre><code>&gt; a
  $elem1
  $elem1$elem2
  [1] 10 20 30 40
  </code></pre>
  
  <p>But,</p>
  
  <pre><code>#
  # This is giving error:
  #
  a &lt;- list()
  a[["elem1"]][["elem2"]] &lt;- c(10)
  a[["elem1"]][["elem2"]] &lt;- c(a[["elem1"]][["elem2"]], c(30,40))
  
  Error in a[["elem1"]][["elem2"]] &lt;- c(a[["elem1"]][["elem2"]], c(30, 40)) : 
  more elements supplied than there are to replace
  </code></pre>
  
  <p>and this is the output of a:</p>
  
  <pre><code>&gt; a
  $elem1
  elem2 
  10 
  </code></pre>
  
  <p>I would appreciate any help.</p>