title: unzipping gz file in R
body: <p>Some R code that used to work to download and unzip .gz files from PubMed is no longer working. Here's a reproducible example:</p>
  <pre><code>filez = &quot;pubmed22n1148.xml.gz&quot;
  url = paste('ftp://ftp.ncbi.nlm.nih.gov/pubmed/updatefiles/', filez, sep='')
  zipped.file = download.file(url = url, destfile=filez) 
  gunzip(filez) 
  </code></pre>
  <p>The error is:</p>
  <pre><code>Error in readBin(inn, what = raw(0L), size = 1L, n = BFR.SIZE) : 
    error reading from the connection
  In addition: Warning message:
  In readBin(inn, what = raw(0L), size = 1L, n = BFR.SIZE) :
    invalid or incomplete compressed data
  </code></pre>
  <p>I'm using R version 4.1.1 and <code>gunzip</code> is from the <code>R.utils</code> package version 2.11.0. The files do not appear to be downloading correctly, as I can use <code>gunzip</code> on a manually downloaded .gz file.  I've experimented with different methods for <code>download.file</code>.</p>