title: Filling a matrix in R
body: <p>I am trying to fill some rows of a (500,2) matrix with the row vector (1,0) using this code, last line is to verify the result:</p>
  
  <pre><code>data&lt;-matrix(ncol=2,nrow=500)
  data[41:150,]&lt;-matrix(c(1,0),nrow=1,ncol=2,byrow=TRUE)
  data[41:45,]
  </code></pre>
  
  <p>But the result is</p>
  
  <pre><code>&gt; data[41:45,]
       [,1] [,2]
  [1,]    1    1
  [2,]    0    0
  [3,]    1    1
  [4,]    0    0
  [5,]    1    1
  </code></pre>
  
  <p>instead of</p>
  
  <pre><code>&gt; data[41:45,]
       [,1] [,2]
  [1,]    1    0
  [2,]    1    0
  [3,]    1    0
  [4,]    1    0
  [5,]    1    0
  </code></pre>
  
  <p>(1) What am I doing wrong? </p>
  
  <p>(2) Why aren't the row indices in the result 41, 42, 43, 44 and 45?</p>