title: R Subset by row numbers
body: <p>I have a large matrix “A” (14 columns but 250 000 rows). It has no id column. </p>
  
  <p>I have another matrix “B” (14x1) with 14 numbers. </p>
  
  <pre><code>1   1   3   7   15  31  63  127 255 511 1023    2047    4095    8191
  </code></pre>
  
  <p>I would like to subset “A” taking only the rows that have a number in B. Eg. Row 1, 3, 7, 15, 31, etc.</p>
  
  <p>I have tried the following: </p>
  
  <pre><code>newA &lt;- A[nrow(A) %in% c(B),]
  </code></pre>
  
  <p>I didn’t work. I have also tried to add an id column to the large matrix A (e.g. <code>A$id &lt;- 1:nrow(A)</code> but it didn’t work either. </p>