title: R error overwriting file that is not there
body: <p>I'm trying to write a file using <code>openxlsx</code>:</p>
  
  <pre><code>saveWorkbook(wb, file=filename, overwrite=T)
  </code></pre>
  
  <p>gives me no error but no file appears, while</p>
  
  <pre><code>&gt; saveWorkbook(wb, file=filename, overwrite=F)
  Error in saveWorkbook(wb, file = filename, overwrite = F) : 
    File already exists!
  </code></pre>
  
  <p>I can see t6his quite clearly in R:</p>
  
  <pre><code>&gt; filename
  [1] "/home/balter/miseq-239/analysis/beta_diversity//tables/miseq-239_beta_diversity_Genus_clust_unifrac_permanova.xlsx"
  &gt; filedir = gsub('\\/[^/]+$', '', filename)
  &gt; filedir
  [1] "/home/balter/miseq-239/analysis/beta_diversity//tables"
  &gt; file.exists(filename)
  [1] TRUE
  &gt; list.files(path=filedir)
  character(0)
  </code></pre>
  
  <p>What is going on?</p>