title: map left_join to a lot of matching tables by there names in a list
body: <p>How can I join tables when there are many each related to another?</p>
  <p>In the example I have two sets of tables. I try to add the totals from the tables from 2021 to the tables from 2022 as a new column with the name 2021. I have more than 100 of such table sets for 4 years back. Therefor I look for a possibility to map (or loop) the left_joins (or cbind or whatever) by a list of the table names. This is my naive try:</p>
  <pre><code>library(dplyr)
  
  # Table 1 from 2022
  T1 &lt;- tibble(Variable = c(&quot;DS&quot;, &quot;SR&quot;, &quot;TI&quot;, &quot;Total&quot;), 
              Total = c(&quot;71%&quot;, &quot;24%&quot;, &quot;5%&quot;, &quot;100%&quot;))
  T1
  
  # Table 1 from 2021
  T1_2021 &lt;- tibble(Variable = c(&quot;DS&quot;, &quot;SR&quot;, &quot;TI&quot;, &quot;Total&quot;), 
                    Total = c(&quot;40%&quot;, &quot;40%&quot;, &quot;20%&quot;, &quot;100%&quot;))
  T1_2021
  
  # here I simple left_join the T1 and T1_2021 to apply the Total from 2021 to a new column '2021' into T_2022_2021 (works)
  T1_2022_and_total_of_2021 &lt;- left_join(T1, T1_2021 %&gt;% 
                             select(Variable, Total) %&gt;%
                             rename('2021' = Total),
                           by = &quot;Variable&quot;) 
  T1_2022_and_total_of_2021
  
  # other related tables
  ## Table 2 from 2022
  T2 &lt;- tibble(Variable = c(&quot;m&quot;, &quot;f&quot;, &quot;Total&quot;), 
               Total = c(&quot;45&quot;, &quot;55%&quot;, &quot;100%&quot;))
  
  ## Table 2 from 2021
  T2_2021 &lt;- tibble(Variable = c(&quot;m&quot;, &quot;f&quot;, &quot;Total&quot;), 
                    Total = c(&quot;48%&quot;, &quot;52%&quot;, &quot;100%&quot;))
  
  # then I have a List with the names of my tables from 2022 (in real more than 100)
  
  tab_list &lt;- list(&quot;T1&quot;, &quot;T2&quot;)
  
  # then I try to map the left_joins for every table from 2021 to the equivalent table from 2022 (T1, T2)
  map(tab_list, ~left_join(.x, paste0(.x, &quot;_2021&quot;) %&gt;% 
                             select(Variable, Total) %&gt;%
                             rename('2021' = Total),
                           by = &quot;Variable&quot;))
  </code></pre>
  <p>How can I get this to work?</p>