title: Appending NA into a list
body: <p>I have this list of lists:</p>
  <pre><code>list&lt;-list(c(0.295017919325516, 0.280103991013988, 0.240898624596022, 
  0.199677069304782, 0.173637393108632, 0.222134859203746, 0.39823944169409, 
  0.391882741855366, 0.21577600728402), c(0.28121757181295, 0.277422184992648, 
  0.230017887789819, 0.191847488360009, 0.17455140669152, 0.205591186569629, 
  0.4063428966179, 0.429863712702859, 0.248064462722642), c(0.271557391953248, 
  0.294647273450576, 0.259500615962201, 0.248402892690127, 0.178084892253651, 
  0.215066463654523, 0.40516205719907, 0.27382824544534), c(0.260821771231842, 
  0.260253867737171, 0.264572075610469, 0.175500821018062, 0.181187522322482, 
  0.197811527945056, 0.393032174562975, 0.336606928254994), c(0.274566347073192, 
  0.271933284859567, 0.267972728722684, 0.211355730670407, 0.180921784930061, 
  0.185393876280435, 0.384058108716521, 0.374405949140189, 0.312466672989218
  ), c(0.282151980564761, 0.28721079361022, 0.31787138268144, 0.24739190298477, 
  0.186615966111228, 0.158811690362167, 0.395599896385276, 0.386374201627084, 
  0.297715499076704))
  </code></pre>
  <p>I would like to append a <code>NA</code> after the seventh position of vectors when they have a length &lt; 9.</p>
  <p>My attempt :</p>
  <pre><code>for (i in length(list){
    if (length(list[[i]]) &lt; 9){
      list[[i]]&lt;-append(list[[i]],NA,after=list[[i]][7])
    }
  }
  </code></pre>
  <p>But it gives the wrong result.</p>
  <p>The core problem is that</p>
  <pre><code>append(list[[1]],NA,after=list[[1]][7])
  </code></pre>
  <p>gives</p>
  <pre><code> [1] 0.2950179        NA 0.2950179 0.2801040 0.2408986 0.1996771 0.1736374 0.2221349
   [9] 0.3982394 0.3918827
  </code></pre>
  <p>while I'd like it to be</p>
  <pre><code> [1] 0.2950179 0.2950179 0.2801040 0.2408986 0.1996771 0.1736374 0.2221349        NA
   [9] 0.3982394 0.3918827
  </code></pre>
  <p>And I don't understand why.</p>