title: Validate data from website before downloading in R
body: <p>I have a bunch of weather data files I want to download, but there's a mix of website url's that have data and those that don't.  I'm using the download.file function in R to download the text files, which is working fine, but I'm also downloading a lot of empty text files because all the url's are valid, even if no data is present.</p>
  <p>For example, this url provides good data.</p>
  <pre><code>http://weather.uwyo.edu/cgi-bin/sounding?region=naconf&amp;TYPE=TEXT%3ALIST&amp;YEAR=2021&amp;MONTH=12&amp;FROM=3000&amp;TO=3000&amp;STNM=72645
  </code></pre>
  <p>But this one doesn't.</p>
  <pre><code>http://weather.uwyo.edu/cgi-bin/sounding?region=naconf&amp;TYPE=TEXT%3ALIST&amp;YEAR=1970&amp;MONTH=12&amp;FROM=3000&amp;TO=3000&amp;STNM=72645
  </code></pre>
  <p>Is there a way to check to see if there's valid data in the text file before I download it?  I've looked for something in the RCurl package, but didn't see what I needed.  Thank you.</p>