title: Aggregate while subtracting values in R
body: <p>If I have two data frames in R (let's call them <code>df1</code> and <code>df2</code> respectively) such as</p>
  
  <pre><code>&gt; df1
  state num1
     AL 22
     AK 49
     AZ 48
     AR 25
  </code></pre>
  
  <p>and</p>
  
  <pre><code>&gt; df2
  state num2
     AK 2
     AZ 3
     AR 4
     CA 5
  </code></pre>
  
  <p>how do I aggregate those data frames while subtracting the values to form something like</p>
  
  <pre><code>state num3
     AL 22
     AK 47
     AZ 45
     AR 21
     CA -5
  </code></pre>
  
  <p>Note: the key values are not the same in the data frames; the data frames have different numbers of rows</p>