title: Replace first `m` elements of an array
body: <p>I have an array of length <code>n</code>. I'd like to replace its first <code>m&lt;n</code> elements with 0. Obviously, a simple for loop can perform this task:</p>
  
  <pre><code>m&lt;-100
  n&lt;-1000
  x&lt;-runif(n)
  for(i in 1:m){
    x[i]&lt;-0
  }
  </code></pre>
  
  <p>Is there a more efficient solution? Thanks!</p>