title: Multiple If Statements in R
body: <p>I've been trying to figure this out all day but to no avail. 
  I have an if statement that is meant to satisfy four possible conditions.</p>
  
  <ol>
  <li>A exists and B does not exist</li>
  <li>B exists and A doesn't exist</li>
  <li>A &amp; B exist</li>
  <li>A &amp; B do not exist</li>
  </ol>
  
  <p>A, B, C are dataframes.</p>
  
  <p>Here is my code:</p>
  
  <pre><code>if (!exists("A") &amp; exists("B")) {
    C= B} 
  else if (exists("A") &amp; !exists("B")) {
    C= A}
  else if (exists("A") &amp; exists("B")) {
    C= rbind(B,A)} 
  else {C &lt;- NULL}
  </code></pre>
  
  <p>I keep getting an error on unexpected "}" and unexpected "else".
  I've followed several examples but still facing this challenge. Any pointers would be much appreciated. Thx.</p>