title: Merging data by 2 variables in R
body: <p>I am attempting to merge two data sets. In the past I have used <code>merge()</code> with <code>by</code> equal to the variable I want to merge by. However, now I would like to do so with two variables. My first data set looks something like this:</p>
  
  <pre><code>Year   Winning_Tm    Losing_Tm
  2011   Texas         Washington
  2012   Alabama       South Carolina
  2013   Tennessee     Texas
  </code></pre>
  
  <p>Then I have another data set with a rank of each team (this is very simplified) for each year. Like this:</p>
  
  <pre><code>Year    Team             Rank
  2011    Texas            32
  2011    Washington       34
  2012    South Carolina   45
  2012    Alabama          12
  2013    Texas            6
  2013    Tennessee        51
  </code></pre>
  
  <p>I would like to merge them so I have a data set that looks like this:</p>
  
  <pre><code>Year   Winning_Tm    Winning_TM_rank    Losing_Tm        Losing_Tm_rank
  2011   Texas         32                 Washington       34
  2012   Alabama       12                 South Carolina   45
  2013   Tennessee     51                 Texas            6
  </code></pre>
  
  <p>My hope is that there is a simple way to do this but it may be more complicated. Thanks!</p>