title: "Join columns must be present in data" error with dplyr left_join
body: <p>I have a problem when I use <code>left_join()</code> to join datasets and using lookup tables to further clean values. Any help with this problem would be extremely helpful since I am new to R. Thank you for your time.</p>
  <pre><code>Error: Join columns must be present in data. x Problem with `Departments and Agencies - EN`. Run `rlang::last_error()` to see where the error occurred.
  </code></pre>
  <p>Below are my code</p>
  <pre><code>lookup_replace &lt;- function(data, sheet, column){
    lookup &lt;- read_xlsx('~/GAC/file26f868d29ad.xlsx', sheet = sheet, na = c(&quot;NA&quot;))
  
    temp &lt;- data %&gt;% 
    left_join(lookup, by = setNames(column, column)) %&gt;%
    mutate(!!sym(column) := new_value) %&gt;%
    select(-new_value)
    return(temp)
  }
  
  # something is wrong with the french columns
  hpds_all_replaced &lt;- hpds_all_raw %&gt;% 
    lookup_replace(1, 'Departments and Agencies - EN') %&gt;%
    lookup_replace(2, 'Ministères et agences - FR') %&gt;% 
    lookup_replace(3, 'Reporting Level 1 - EN') %&gt;%
    lookup_replace(4, 'Niveau de rapport 1 - FR') %&gt;%
    lookup_replace(5, 'Reporting Level 2 - EN') %&gt;%
    lookup_replace(6, 'Niveau de rapport 2 - FR') %&gt;%
    lookup_replace(7, 'GAC-Branch-EN') %&gt;%
    lookup_replace(8, 'AMC-Direction générale-FR') %&gt;%
    lookup_replace(12, 'Action Areas-EN') %&gt;%
    lookup_replace(13, &quot;Champs d'action-FR&quot;) %&gt;%
    lookup_replace(14, 'Sub-Action Areas-EN')
    lookup_replace(15, &quot;Volets des champs d'action-FR&quot;)
  </code></pre>
  <pre><code>dataset_names &lt;- list(
    'Departments and Agencies - EN' = one,
    'Ministères et agences - FR' = two,
    'Reporting Level 1 - EN' = three,
    'Niveau de rapport 1 - FR' = four,
    'Reporting Level 2 - EN' = five,
    'Niveau de rapport 2 - FR' = six,
    'GAC-Branch-EN' = seven,
    'AMC-Direction générale-FR' = eight,
    'Recipient Organization - EN' = nine,
    'Organisation bénéficiaire - FR' = ten,
    &quot;GAC's Gender Equality&quot; = eleven,
    'Action Areas-EN' = twelve,
    &quot;Champs d'action-FR&quot; = thirteen,
    'Sub-Action Areas-EN', fourteen,
    &quot;Volets des champs d'action-FR&quot; = fifteen,
    'GAC-Section-EN' = sixteen,
    'GAC-Division-EN' = seventeen,
    'Org level 1 - EN' = eighteen,
    'Org niveau 1 - FR' = nineteen,
    'Org level 2 - EN' = twenty,
    'Org niveau 2 - FR' = twenty_one)
  
  write.xlsx(dataset_names, file = '~/GAC', sheetName = 'lookup_table.xlsx')
  </code></pre>