title: Conditional replacement of values in a dataframe (by values at other places)
body: <p>I have a <code>data frame</code> like <em>MyData</em> below:</p>
  <pre><code>country &lt;- c(&quot;Gr&quot;,&quot;Gr&quot;,&quot;Gr&quot;,&quot;It&quot;,&quot;It&quot;,&quot;Eg&quot;,&quot;Eg&quot;,&quot;Li&quot;)
  continent &lt;- c(&quot;Eu&quot;,NA,NA,&quot;Eu&quot;,NA,&quot;Af&quot;,NA,&quot;Af&quot;)
  SomeData &lt;- c(3,1,5,6,2,8,2,9)
  MyData &lt;- data.frame(Country=country, Continent=continent, Data=SomeData)
  </code></pre>
  <p>As you can see, the continent of Greece is Europe in some places, but is <code>NA</code> in most of the places. The same with Egypt and other countries of the real data frame. <strong>I want to replace the <code>NA</code>s with the name of the country's continent, as it is named in the data frame</strong> (Eu, Af, etc).</p>
  <p>Is it possible?</p>
  <p>Thanks in advance!</p>
  <p>PS1: I read <a href="https://stackoverflow.com/questions/8214303/conditional-replacement-of-values-in-a-data-frame">this</a> and <a href="https://stackoverflow.com/questions/5824173/replace-a-value-in-a-data-frame-based-on-a-conditional-if-statement?rq=1">this</a>. None of them answers my question.
  PS2: I have too many countries' names to manage.</p>