Re: [R] How to download and unzip data in a loop

2015-02-05 Thread David Winsemius
On Feb 5, 2015, at 10:03 AM, Alexandra Catena wrote: Thank you guys for the response. I'm trying to download the last ten years of meteorology data from a weather station in Livermore from the URL: ftp://ftp.ncdc.noaa.gov/pub/data/noaa/2015/724927-23285-2015.gz The Livermore station code

Re: [R] How to download and unzip data in a loop

2015-02-05 Thread Alexandra Catena
Thank you guys for the response. I'm trying to download the last ten years of meteorology data from a weather station in Livermore from the URL: ftp://ftp.ncdc.noaa.gov/pub/data/noaa/2015/724927-23285-2015.gz The Livermore station code is 724927-23285. If I wanted to download data from 2005, the

Re: [R] How to download and unzip data in a loop

2015-02-05 Thread Jon Skoien
In addition to following Jim's suggestion, you should probably also use full.names = TRUE, otherwise you will try to open a connection to files in your current directory, not in tmpdir. Another thing is that the unzipped files appear irregular with respect to columns, so read.table might not

Re: [R] How to download and unzip data in a loop

2015-02-05 Thread jim holtman
try taking the quotes off of 'files' Jim Holtman Data Munger Guru What is the problem that you are trying to solve? Tell me what you want to do, not how you want to do it. On Wed, Feb 4, 2015 at 5:24 PM, Alexandra Catena amc5...@gmail.com wrote: Hi All, I need to loop through and download

Re: [R] How to download and unzip data in a loop

2015-02-05 Thread Jeff Newmiller
Dunno. Try posting your current code that fixes the previously mentioned problems, but this time use plain text so the HTML doesn't corrupt it. Usually you can solve this kind of issue by executing one line at a time and looking at each result to make sure it is what you think it is. You can

[R] How to download and unzip data in a loop

2015-02-04 Thread Alexandra Catena
Hi All, I need to loop through and download the past 10 years of met data to a temporary directory. I then need to unzip it and place it into another directory. year = (2005:2015) for (i in year) tmpdir = tempdir() file[i] = file.path(tmpdir, sprintf('724927-23285-%4i.gz', i)) url =