title: Replace a value NA with the value from another column in R
body: <p>I want to replace the NA value in dfABy from the column A, with the value from the column B, based on the year of column year. For example, my df is: </p>
  
  <pre><code>                 &gt;dfABy 
                   A    B   Year
                   56   75  1921
                   NA   45  1921
                   NA   77  1922
                   67   41  1923
                   NA   65  1923
  </code></pre>
  
  <p>The result what I will attend is: </p>
  
  <pre><code>                 &gt; dfABy
                   A    B   Year
                   56   75  1921
                  *45*  45  1921
                  *77*  77  1922
                   67   41  1923
                  *65*  65  1923
  </code></pre>
  
  <p>P.S: with the * the value replacing in column A from column B for every year            </p>