title: Insert elements into a vector at given indexes
body: <p>I have a logical vector, for which I wish to insert new elements at particular indexes. I've come up with a clumsy solution below, but is there a neater way?</p>
  
  <pre><code>probes &lt;- rep(TRUE, 15)
  ind &lt;- c(5, 10)
  probes.2 &lt;- logical(length(probes)+length(ind))
  probes.ind &lt;- ind + 1:length(ind)
  probes.original &lt;- (1:length(probes.2))[-probes.ind]
  probes.2[probes.ind] &lt;- FALSE
  probes.2[probes.original] &lt;- probes
  
  print(probes)
  </code></pre>
  
  <p>gives</p>
  
  <pre><code>[1] TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE
  </code></pre>
  
  <p>and</p>
  
  <pre><code>print(probes.2)
  </code></pre>
  
  <p>gives</p>
  
  <pre><code>[1]  TRUE  TRUE  TRUE  TRUE  TRUE FALSE  TRUE  TRUE  TRUE  TRUE  TRUE FALSE
  [13]  TRUE  TRUE  TRUE  TRUE  TRUE
  </code></pre>
  
  <p>So it works but is ugly looking - any suggestions?</p>