[R] problems with download.file() from ftp?

Tony Breyal tony.breyal at googlemail.com
Mon Jan 12 17:17:03 CET 2009


I ran your script on Windows Vista Ultimate, SP1 and it worked fine:

## R start...
> url <- 'ftp://ftp.wcc.nrcs.usda.gov/data/snow/snow_course/table/history/idaho/13e19.txt'
> dest <- "//PFO-SBS001/Redirected/tonyb/Desktop/test/downloadtest.txt"
> download.file(url, dest)
trying URL 'ftp://ftp.wcc.nrcs.usda.gov/data/snow/snow_course/table/
history/idaho/13e19.txt'
ftp data connection made, file length 5026 bytes
opened URL
downloaded 5026 bytes
## R end.


> sessionInfo()
R version 2.8.1 (2008-12-22)
i386-pc-mingw32

locale:
LC_COLLATE=English_United Kingdom.1252;LC_CTYPE=English_United Kingdom.
1252;LC_MONETARY=English_United Kingdom.
1252;LC_NUMERIC=C;LC_TIME=English_United Kingdom.1252

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods
base
>


On 12 Jan, 14:51, zack holden <zack_hol... at hotmail.com> wrote:
> Dear list,
>
> I am trying to download a text file from an ftp site using download.file().
>
> I used the following code:
> url <- "ftp://ftp.wcc.nrcs.usda.gov/data/snow/snow_course/table/history/idaho..."
> dest <- "c:/test/downloadtest.txt"
> download.file(url, dest)
> I get this error message, indicating that R is unable to open the connection:
> trying URL 'ftp://ftp.wcc.nrcs.usda.gov/data/snow/snow_course/table/history/idaho...
> Error in download.file(url, dest) :
>   cannot open URL 'ftp://ftp.wcc.nrcs.usda.gov/data/snow/snow_course/table/history/idaho...
>
> I'm sure there is a simple solution that allows R to open this connection, but after reading the "url" help file for an hour, I can't seem to find the solution. Is anyone willing to help me solve this problem?
>
> thanks in advance for any advice,
>
> Zack
>
> ______________________________________________
> R-h... at r-project.org mailing listhttps://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guidehttp://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.




More information about the R-help mailing list