title: How to left_join in R and repeat joining value to multiple variables?
body: <p>I'm confusing something here, either this isn't the right approach or I'm missing a part of the left_join:</p>
  
  <p>I'm looking to join the "gdp" column, by country and by year, and repeat the value across all three "gender" categories, in a way that all three genders for the same year will have the same associated gdp.</p>
  
  <p>Here's what I have now:</p>
  
  <pre><code>library(tidyverse)
  
  table_1 &lt;- tribble(~"Region",~"Country",~"Year", ~"Gender", ~"median_rate",
   "Central and Southern Asia", "Afghanistan",  2011, "female",       0.186,
  "Central and Southern Asia","Afghanistan",  2011, "male",         0.454,
   "Central and Southern Asia", "Afghanistan",  2011, "total",        0.274,
   "Central and Southern Asia", "Afghanistan",  2018, "female",       0.221,
   "Central and Southern Asia", "Afghanistan" , 2018, "male",         0.504,
   "Central and Southern Asia", "Afghanistan",  2018, "total",        0.367)
  
  table_2 &lt;- tribble(~"Country",    ~"gdp", ~"Year",
   "Afghanistan",  551.,  2010,
   "Afghanistan", 599.,2011,
   "Afghanistan",  649.,  2012,
   "Afghanistan",  648.,  2013,
   "Afghanistan",  625.,  2014,
   "Afghanistan",  590.,  2015,
   "Afghanistan",  550.,  2016,
   "Afghanistan",  550.,  2017)
  
  table_1 %&gt;% left_join(table_2, by = "Country")
  
  # A tibble: 48 x 7
     Region                    Country     Year.x Gender median_rate   gdp Year.y
     &lt;chr&gt;                     &lt;chr&gt;        &lt;dbl&gt; &lt;chr&gt;        &lt;dbl&gt; &lt;dbl&gt;  &lt;dbl&gt;
   1 Central and Southern Asia Afghanistan   2011 female       0.186   551   2010
   2 Central and Southern Asia Afghanistan   2011 female       0.186   599   2011
   3 Central and Southern Asia Afghanistan   2011 female       0.186   649   2012
   4 Central and Southern Asia Afghanistan   2011 female       0.186   648   2013
   5 Central and Southern Asia Afghanistan   2011 female       0.186   625   2014
   6 Central and Southern Asia Afghanistan   2011 female       0.186   590   2015
   7 Central and Southern Asia Afghanistan   2011 female       0.186   550   2016
   8 Central and Southern Asia Afghanistan   2011 female       0.186   550   2017
   9 Central and Southern Asia Afghanistan   2011 male         0.454   551   2010
  10 Central and Southern Asia Afghanistan   2011 male         0.454   599   2011
  # ... with 38 more rows
  
  </code></pre>
  
  <p>Expected output would be something like this, with the gdp column from table 2 joined, but only for each matching year, (e.g. in table 1 there is only data from 2011 and 2018, so it should only match these years)</p>
  
  <pre><code>tribble(~"Region",~"Country",~"Year", ~"Gender", ~"median_rate",~"gdp",
          "Central and Southern Asia", "Afghanistan",  2011, "female",0.186, 550,
          "Central and Southern Asia","Afghanistan",  2011, "male",0.454,550,
          "Central and Southern Asia", "Afghanistan",  2011, "total",0.274,550,
          "Central and Southern Asia", "Afghanistan",  2018, "female", 0.221,590,
          "Central and Southern Asia", "Afghanistan" , 2018, "male",         0.504, 590,
          "Central and Southern Asia", "Afghanistan",  2018, "total",        0.367, 590)
  
  
  </code></pre>
  
  <p>Thanks for your help,</p>