title: Add a column to a cross tabulation table from a different data frame
body: <p>I would like to create a cross tabulation table with <code>table</code> and <code>addmargins</code> and then add a column from another data frame to the table.</p>
  <p>Example data:</p>
  <pre><code>df &lt;- data.frame(country = c(&quot;B&quot;, &quot;A&quot;, &quot;C&quot;, &quot;C&quot;, &quot;A&quot;, &quot;A&quot;, &quot;B&quot;, &quot;C&quot;, &quot;C&quot;), year = c(2005, 2006, 2005, 2007, 2005, 2005, 2007, 2006, 2006))
  
  df2 &lt;- data.frame(country = c(&quot;C&quot;, &quot;B&quot;, &quot;A&quot;, &quot;C&quot;, &quot;A&quot;, &quot;B&quot;, &quot;C&quot;, &quot;A&quot;, &quot;A&quot;, &quot;A&quot;, &quot;B&quot;, &quot;C&quot;, &quot;B&quot;, &quot;A&quot;, &quot;C&quot;))
  </code></pre>
  <p>I would like to combine:</p>
  <pre><code>addmargins(table(df$country, df$year), FUN = list(Total = sum))
  
  addmargins(table(df2$country), FUN = list(Total = sum))
  </code></pre>
  <p>such that I get</p>
  <pre><code>        2005 2006 2007 Total df2
  A        2    1    0     3   6
  B        1    0    1     2   4
  C        1    2    1     4   5
  Total    4    3    2     9   15
  </code></pre>