Re: [R] download.file()

From: Henrik Bengtsson <hb_at_stat.berkeley.edu>
Date: Tue, 18 Mar 2008 08:59:45 -0700

On Tue, Mar 18, 2008 at 8:57 AM, Henrik Bengtsson <hb_at_stat.berkeley.edu> wrote:
> On Tue, Mar 18, 2008 at 8:46 AM, Paul Evans <p.evans48@yahoo.com> wrote:
> > Hi,
> >
> > I wanted to download a file and did the following:
> > ---------------------------------------------------------
> > > fileLink <- '
ftp://ftp.ncbi.nih.gov/pub/geo/DATA/supplementary/series/GSE1000/GSE1000_RAW.tar'
> > > download.file(fileLink,'/geoDat')
> > trying URL 'ftp://ftp.ncbi.nih.gov/pub/geo/DATA/supplementary/series/GSE1000/GSE1000_RAW.tar'
> > ftp data connection made, file length 35307520 bytes
> > opened URL
> > downloaded 34480Kb
> >
> > >
> > ------------------------------------------------------------
> >
> > However, when I look in the destination directory ('/geoDat'), the file is not there (I also tried giving it the absolute path).
> >
> > What am I doing wrong?

>

> I'm quite sure the 'destfile' argument of download.file() is a file
> not a directory. Example:
>

> > download.file("http://www.r-project.org/index.html", destfile="foo.html")
> > file.info("foo.html")
> size isdir mode mtime ctime
> foo.html 785 FALSE 666 2008-03-18 08:54:19 2008-03-18 08:54:11
> atime exe
> foo.html 2008-03-18 08:54:19 no
>

> So you probably saved the downloaded file as 'geoDat' in the root
> directory '/'.

Also, you want to download the file in a binary fashion, i.e. use argument mode="wb", otherwise your binary tar file will be corrupt.

R-core: I'd suggest to replace the default to mode="wb" for file transfers.

/Henrik

>

> /Henrik
>
>
>
>

> >
> > thanks!
> >
> >
> >
> >
> > ____________________________________________________________________________________
> > Be a better friend, newshound, and
> >
> >
> > [[alternative HTML version deleted]]
> >
> > ______________________________________________
> > R-help_at_r-project.org mailing list
> > https://stat.ethz.ch/mailman/listinfo/r-help
> > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> > and provide commented, minimal, self-contained, reproducible code.
> >
>

R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Tue 18 Mar 2008 - 16:18:25 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Tue 18 Mar 2008 - 17:30:22 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive