title: R - Replace values starting in selected column by row
body: <p>I want to replace with zero the monthly values that are after a specific month by row.  I have tried adapting <a href="https://stackoverflow.com/questions/42417700/replace-na-values-in-dataframe-starting-in-varying-columns">Replace NA values in dataframe starting in varying columns</a> without success. Given data:</p>
  
  <pre><code>df &lt;- structure(list(Mth1 = c(1L, 3L, 4L, 1L, 2L), 
                        Mth2 = c(2L, 3L, 2L, 2L, 2L),
                        Mth3 = c(1L, 2L, 1L, 2L, 3L), 
                        Mth4 = c(3L, 1L, 3L, 4L, 2L),
                        ZeroMth = c(1L, 3L, 2L, 4L, 3L)),
                   .Names = c("Mth1", "Mth2", "Mth3", "Mth4", "ZeroMth"), class = "data.frame", 
                   row.names = c("1", "2", "3", "4", "5"))
  
  
  &gt; df
    Mth1 Mth2 Mth3 Mth4 ZeroMth
  1    1    2    1    3       1
  2    3    3    2    1       3
  3    4    2    1    3       2
  4    1    2    2    4       4
  5    2    2    3    2       3
  </code></pre>
  
  <p>I would like to use the values in the ZeroMth column to specify the month where the replacements start.  The desired output is:</p>
  
  <pre><code>&gt; df1
    Mth1 Mth2 Mth3 Mth4
  1    0    0    0    0
  2    3    3    0    0 
  3    4    0    0    0
  4    1    2    2    0
  5    2    2    0    0
  </code></pre>