title: How to merge multiple xlsx files into a single xlsx file by the first part of each file's name using R?
body: <p>I have several .xlsx files in a directory:</p>
  
  <pre><code>Russia - GDP.xlsx
  Russia - GNP.xlsx
  USA - GDP.xlsx
  USA - GNP.xlsx
  </code></pre>
  
  <p>I would like to combine the files according to the first part of the files name into a new xlsx file. So the output would look like this:</p>
  
  <pre><code>Russia.xlsx
  USA.xlsx
  </code></pre>
  
  <p>With each .xlsx file containing two tabs: GDP and GNP.</p>
  
  <p>Is there a way to do this using R? Thanks for your help.</p>