title: R: How do I copy a value from a table and paste it into all rows within a specified row number range?
body: <p>The current issue I am facing is that I have generated a list of row numbers based on the location of specific values within a table. This is as follows:</p>
  <pre><code>row_values &lt;- which(table[,1] == &quot;place of work :&quot;)
  </code></pre>
  <p>This leaves me with a list of all the row numbers in which &quot;place of work&quot; appears:</p>
  <pre><code>[1]     1   406   811  1216  1621  2026  2431  2836  3241  3646  4051  4456  4861  5266  5671  6076  6481  6886  7291  7696  8101  8506  8911  9316  9721 10126
  [27] 10531 10936 11341 11746 12151 12556
  </code></pre>
  <p>This is 32 entries in total. I then also have another table which contains a number of codes (32 in total):</p>
  <pre><code>Area Code (Origin)
   [1,] &quot;E41000293&quot;       
   [2,] &quot;E41000294&quot;       
   [3,] &quot;E41000295&quot;       
   [4,] &quot;E41000296&quot;       
   [5,] &quot;E41000297&quot;       
   [6,] &quot;E41000298&quot;       
   [7,] &quot;E41000299&quot;       
   [8,] &quot;E41000300&quot;       
   [9,] &quot;E41000301&quot;       
  [10,] &quot;E41000302&quot;       
  [11,] &quot;E41000303&quot;       
  [12,] &quot;E41000304&quot;       
  [13,] &quot;E41000305&quot;       
  [14,] &quot;E41000306&quot;       
  [15,] &quot;E41000307&quot;       
  [16,] &quot;E41000308&quot;       
  [17,] &quot;E41000309&quot;       
  [18,] &quot;E41000310&quot;       
  [19,] &quot;E41000311&quot;       
  [20,] &quot;E41000312&quot;       
  [21,] &quot;E41000313&quot;       
  [22,] &quot;E41000314&quot;       
  [23,] &quot;E41000315&quot;       
  [24,] &quot;E41000316&quot;       
  [25,] &quot;E41000317&quot;       
  [26,] &quot;E41000318&quot;       
  [27,] &quot;E41000319&quot;       
  [28,] &quot;E41000320&quot;       
  [29,] &quot;E41000321&quot;       
  [30,] &quot;E41000322&quot;       
  [31,] &quot;E41000323&quot;       
  [32,] &quot;E41000324&quot;
  </code></pre>
  <p>I need to find a way to paste those &quot;Area Code (Origin)&quot; values into the original table in every row between what the row_values as shown. These would sit in a blank column I have called &quot;Area Codes (Destinations)&quot;. I.e, E41000293 should sit in the Area Code Destinations Column for every row from 1 to 405, E41000294 should sit from 406 to 810 ect.</p>
  <p>Any help with this would be greatly appreciated as I am at a loss for how best to approach this.</p>
  <p>Thanks,
  Joe</p>