title: Replicate a list to create a list-of-lists
body: <p>I am trying to create a list with the following (nested) structure:</p>
  
  <pre><code>l &lt;- list()
  for(i in seq(5)) l[[i]] &lt;- list(a=NA,b=NA)
  &gt; str(l)
  List of 5
   $ :List of 2
    ..$ a: logi NA
    ..$ b: logi NA
   $ :List of 2
    ..$ a: logi NA
    ..$ b: logi NA
   $ :List of 2
    ..$ a: logi NA
    ..$ b: logi NA
   $ :List of 2
    ..$ a: logi NA
    ..$ b: logi NA
   $ :List of 2
    ..$ a: logi NA
    ..$ b: logi NA
  </code></pre>
  
  <p>I'd like to do this via <code>rep</code> or similar, as I'm creating a whole bunch of blank lists which I will later fill in.  (I'm aware that I can just expand a list via referring to its next index, but that doesn't work when indexing two-deep).</p>
  
  <p>I thought that <code>rep</code> worked for this, but it does not appear to.  <code>?rep</code> gives the following example:</p>
  
  <pre><code>fred &lt;- list(happy = 1:10, name = "squash")
  rep(fred, 5)
  </code></pre>
  
  <p>Which returns:</p>
  
  <pre><code>&gt; str(rep(fred, 5))
  List of 10
   $ happy: int [1:10] 1 2 3 4 5 6 7 8 9 10
   $ name : chr "squash"
   $ happy: int [1:10] 1 2 3 4 5 6 7 8 9 10
   $ name : chr "squash"
   $ happy: int [1:10] 1 2 3 4 5 6 7 8 9 10
   $ name : chr "squash"
   $ happy: int [1:10] 1 2 3 4 5 6 7 8 9 10
   $ name : chr "squash"
   $ happy: int [1:10] 1 2 3 4 5 6 7 8 9 10
   $ name : chr "squash"
  </code></pre>
  
  <p>In other words, it flattens the list.</p>
  
  <p>I've also tried <code>list( rep(fred,5) )</code> which similarly fails.</p>
  
  <p>How do I replicate a list-of-lists?</p>