[R] FTP download from ftp.sec.gov

Gabor Grothendieck ggrothendieck at gmail.com
Fri Mar 2 00:36:39 CET 2007


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@ftp.sec.gov/edgar/full-index/company.idx"
> download.file(url=ftp, destfile="test.txt")
trying URL 'ftp://anonymous:test@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@ftp.sec.gov/edgar/full-index/company.idx"
> download.file(url=ftp, destfile="test.txt")
trying URL 'ftp://anonymous:test@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@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
>
>



More information about the R-help mailing list