title: Copy unique values from one column to another R
body: <p>I have recently started using R and although I have a manual for it I keep on finding that the functions that I need can't be found there. Here is a problem I stumbled upon. </p>
  
  <p>MY data looks something like this:</p>
  
  <pre><code>col1    col2    col3
  Alex    NA  URL
  Mike    URL NA
  John    URL URL
  Peter   NA  NA
  James   NA  URL
  </code></pre>
  
  <p>Col1 will always be a unique categorical value. Col2 represents the source where these people are coming from, to my website (URL means that there is an entire URL in there , could http.www.facebook.com). NA means that the user came to my website viral. Col3 represents the referal (another indication of where the user came from). </p>
  
  <p>What I need to do is to transfer or copy data from col3 into col2, based on the following condition: IF in col 3 I have an URL and in col2 I have NA, then the cell with the URL from col3 I need it copyied to col2. If col3 and col2, both have URL then I don't want anything to happen there. If col 3 has NA and col2 has URL, again I don't want anything to change. Here is the desired output</p>
  
  <pre><code>col1    col2                    col3   
  Alex    URL(copied from col3)   URL
  Mike    URL(kept this URL)      NA
  John    URL(kept this URL)      URL
  Peter   NA(Kept NA)             NA
  James   URL(copied from col3)   URL
  </code></pre>
  
  <p>SO, Alex and James got the URL from col3 , John and Mike kept their initial URL that were in col2 and Peter kept his NA. </p>
  
  <p>Now, I have looked everywhere , even on this website and was unable to find anything about copying data from one column to another using "IF" conditions. The only thing I found was how to copy an entire column from one dataframe to another by using the "merge" function, but apart from that nothing else. </p>
  
  <p>Does a function exist that could acomplish this?</p>