Skip to content

download.file()

7 messages · Paul Evans, Henrik Bengtsson, Stefan Grosse +1 more

#
On Tue, Mar 18, 2008 at 8:46 AM, Paul Evans <p.evans48 at yahoo.com> wrote:
I'm quite sure the 'destfile' argument of download.file() is a file
not a directory. Example:
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 '/'.

/Henrik
#
On Tue, Mar 18, 2008 at 8:57 AM, Henrik Bengtsson <hb at stat.berkeley.edu> wrote:
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
#
On Tuesday 18 March 2008 04:46:12 pm Paul Evans wrote:
PE> > download.file(fileLink,'/geoDat')
I would have expected

download.file(fileLink,"/geoDat/yourfilename")

note that you need your complete path (or use setwd)
#
/geodat *is* an absoute path!

The second argument of download.file is called 'destfile', so what makes 
you think it is a desination *directory*?

Your command works for me, using an account that has write permission in / 
, and not otherwise.  (It seems very unsafe that you would be using such 
an account unless this is a pre-Vista Windows machine.)
On Tue, 18 Mar 2008, Paul Evans wrote:

            
Not reading the help page?

  
    
#
On Tuesday 18 March 2008 04:59:45 pm Henrik Bengtsson wrote:
HB> Also, you want to download the file in a binary fashion, i.e. use
HB> argument mode="wb", otherwise your binary tar file will be corrupt.
HB>
HB> R-core: I'd suggest to replace the default to mode="wb" for file
HB> transfers. 

I had no corrupt file and I did not specify "wb"

(R-2.6.2 on Fedora 8)

Stefan
#
On Tue, Mar 18, 2008 at 9:10 AM, Prof Brian Ripley
<ripley at stats.ox.ac.uk> wrote:
The help file might be the source of confusion:

"destfile: A character string with the name where the downloaded file
is saved.  Tilde-expansion is performed."

...especially the word "where".  Better with "A character string
specifying the name [pathname?] of the saved file" is better.

/Henrik