title: Is there an R function to make x rows equal to a specific row and repeat the operation?
body: <p>everyone! </p>
  
  <p>Being a beginner with the R software (I think my request is feasible on this software), I would like to ask you a question. </p>
  
  <p>In a large Excel type file, I have a column where the values I am interested in are only every 193 lines. So I would like the previous 192 rows to be equal to the value of the 193rd position ... and so on for all 193 rows, until the end of the column. </p>
  
  <p>Concretely, here is what I would like to get for this little example:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>Month    Fund_number    Cluster_ref_INPUT      Expected_output
  1        1              1                      1
  2        1              1                      1
  3        1              3                      1
  4        1              1                      1
  1        3              2                      NA
  2        3              NA                     NA
  3        3              NA                     NA
  4        3              NA                     NA
  1        8              4                      5
  2        8              5                      5
  3        8              5                      5
  4        8              5                      5</code></pre>
  </div>
  </div>
  </p>
  
  <p>The column "Cluster_ref_INPUT" is partitioned according to the column "Fund_number" (one observation for each fund every month for 4 months). The values that interest me in the INPUT column appear every 4 observations (the value in the 4th month). </p>
  
  <p>Thus, we can see that for each fund number, we find in the column "Expected_output" the values corresponding to the value found in the last line of the column "Cluster_ref_INPUT". (every 4 lines). I think we should partition by "Fund_number" and put that all the lines are equal to the last one... something like that? </p>
  
  <p>Do you have any idea what code I should use to make this work? </p>
  
  <p>I hope that's clear enough. Do not hesitate if I need to clarify. </p>
  
  <p>Thank you very much in advance,</p>
  
  <p>Vanie</p>