title: R Assign Same Value to Multiple Elements of a Vector
body: <p>I have trouble assigning the same value to the multiple elements of a vector. Here is my non-working example:</p>
  
  <pre><code>dog &lt;- c()
  year &lt;- c(1980,1990)
  for (i in 1:2){
       dog[(i*1):(i*12)]&lt;- unique(year)[i]
  }
  </code></pre>
  
  <p>I want the <code>dog</code> vector to have twelve 1980 and twelve 1990. But instead I get a 1980 and 1990 followed by 22 NAs. What's the next step?  </p>