title: Append value to more than one position in vector
body: <p>How do we append a single value to multiple positions in a vector? </p>
  
  <pre><code>x=c(1,2,3)
  append(x, "a", c(1,3))
  [1] "1" "a" "2" "3"
  
  Warning messages:
  1: In if (!after) c(values, x) else if (after &gt;= lengx) c(x, values) else c(x[1L:after],  :
    條件的長度 &gt; 1，因此只能用其第一元素
  2: In if (after &gt;= lengx) c(x, values) else c(x[1L:after], values,  :
    條件的長度 &gt; 1，因此只能用其第一元素
  3: In 1L:after : numerical expression has 2 elements: only the first used
  4: In (after + 1L):lengx :
    numerical expression has 2 elements: only the first used
  </code></pre>
  
  <p>With the above code, only the first position is registered, with a warning message. </p>
  
  <pre><code>lapply(c(1,3), function(y) append(x, 'a', y))
  </code></pre>
  
  <p>yields this result: </p>
  
  <pre><code>[[1]]
  [1] "1" "a" "2" "3"
  
  [[2]]
  [1] "1" "2" "3" "a"
  </code></pre>
  
  <hr>
  
  <p><strong>Expected output:</strong></p>
  
  <pre><code>1 a 2 3 a
  </code></pre>