title: replace elements of one vector by elements of another on particular positions
body: <p>I have following data:</p>
  
  <pre><code>orig.vec &lt;- c(1:10)
  idx      &lt;- c(3,5,6)
  rep.vec  &lt;- list(c(7,7,7), c(8,8,8), c(9,9,9))
  </code></pre>
  
  <p>1st. How can I insert elements of <code>rep.vec</code> into <code>orig.vec</code> at positions contained in <code>idx</code> and shift <code>orig.vec</code> values to left/right?</p>
  
  <p>Desired result:</p>
  
  <ol>
  <li><code>orig.vec</code> shifted to right: <code>1,2,7,7,7,3,4,8,8,8,5,9,9,9,6,7,8,9,10</code></li>
  <li><code>orig.vec</code> shifted to left:  <code>1,2,3,7,7,7,4,5,8,8,8,6,9,9,9,7,8,9,10</code></li>
  </ol>
  
  <p>2nd. How can I replace elements of <code>orig.vec</code> at positions contained in <code>idx</code> by elements of <code>rep.vec</code>?</p>
  
  <p>Desired result:</p>
  
  <p><code>1,2,7,7,7,4,8,8,8,9,9,9,7,8,9,10</code></p>