All, I have managed to download files from web sites and ftp sites using R, so just for fun I tried to do so from the SEC's ftp site using the following code: ftp <- "ftp://anonymous:test at ftp.sec.gov/edgar/full-index/company.idx" download.file(url=ftp, destfile="test.txt") And it does not work. R says it cannot open the URL. If I paste the ftp part into IE it works fine. Its not critical, but I would be interested if anything figures out how to make it work. (I know R is probably not the best language for FTP download and text parsing, but that's another topic). Thanks, Roger ********************************************************************** * This message is for the named person's use only. It may contain confidential, proprietary or legally privileged information. No right to confidential or privileged treatment of this message is waived or lost by any error in transmission. If you have received this message in error, please immediately notify the sender by e-mail, delete the message and all copies from your system and destroy any hard copies. You must not, directly or indirectly, use, disclose, distribute, print or copy any part of this message if you are not the intended recipient.
On Windows XP it worked for me on both 2.4.1 and 2.5.0. I did notice that on 2.4.1 it says "using Synchronous WinInet calls" but does not say this on 2.5.0. See below for the two transcripts.> ftp <- "ftp://anonymous:test at ftp.sec.gov/edgar/full-index/company.idx" > download.file(url=ftp, destfile="test.txt")trying URL 'ftp://anonymous:test at ftp.sec.gov/edgar/full-index/company.idx' using Synchronous WinInet calls opened URL downloaded 33930Kb> R.version.string # XP[1] "R version 2.4.1 Patched (2006-12-30 r40331)" ---> ftp <- "ftp://anonymous:test at ftp.sec.gov/edgar/full-index/company.idx" > download.file(url=ftp, destfile="test.txt")trying URL 'ftp://anonymous:test at ftp.sec.gov/edgar/full-index/company.idx' ftp data connection made, file length 34744813 bytes opened URL downloaded 33930Kb> R.version.string # XP[1] "R version 2.5.0 Under development (unstable) (2007-02-25 r40804)" On 3/1/07, Bos, Roger <roger.bos at us.rothschild.com> wrote:> All, > > I have managed to download files from web sites and ftp sites using R, > so just for fun I tried to do so from the SEC's ftp site using the > following code: > > ftp <- "ftp://anonymous:test at ftp.sec.gov/edgar/full-index/company.idx" > download.file(url=ftp, destfile="test.txt") > > And it does not work. R says it cannot open the URL. If I paste the ftp > part into IE it works fine. Its not critical, but I would be interested > if anything figures out how to make it work. (I know R is probably not > the best language for FTP download and text parsing, but that's another > topic). > > Thanks, Roger > >
Thanks to everyone for trying it out. I guess the part that surprises me is that I currently download a file from a different FTP site every night with no problem. I have also downloaded from web sites with no problem. Buy now that I know the R code is okay I can look into other fixes for the problems. Thanks again, Roger -----Original Message----- From: Peter Dalgaard [mailto:P.Dalgaard at biostat.ku.dk] Sent: Friday, March 02, 2007 3:17 AM To: Gabor Grothendieck Cc: Bos, Roger; r-help at stat.math.ethz.ch Subject: Re: [R] FTP download from ftp.sec.gov Gabor Grothendieck wrote:> On Windows XP it worked for me on both 2.4.1 and 2.5.0. I did notice > that on 2.4.1 it says "using Synchronous WinInet calls" but does not > say this on 2.5.0. See below for the two transcripts. > > >> ftp <- "ftp://anonymous:test at ftp.sec.gov/edgar/full-index/company.idx" >> download.file(url=ftp, destfile="test.txt") >> > trying URL 'ftp://anonymous:test at ftp.sec.gov/edgar/full-index/company.idx' > using Synchronous WinInet calls > opened URL > downloaded 33930Kb >This appears to be highly system dependent. Works for me on my home machine using Fedora 6, but not on the office machine running SUSE 10. I wouldn't be surprised if firewall configuration plays a part. -- O__ ---- Peter Dalgaard ?ster Farimagsgade 5, Entr.B c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk) FAX: (+45) 35327907 ********************************************************************** * This message is for the named person's use only. It may contain confidential, proprietary or legally privileged information. No right to confidential or privileged treatment of this message is waived or lost by any error in transmission. If you have received this message in error, please immediately notify the sender by e-mail, delete the message and all copies from your system and destroy any hard copies. You must not, directly or indirectly, use, disclose, distribute, print or copy any part of this message if you are not the intended recipient.