Skip to content
Prev 126735 / 398500 Next

download.file not working

On 10/11/07, Gustaf Rydevik <gustaf.rydevik at gmail.com> wrote:
When you transfer something in "binary" mode, you will receive an
identical copy of the file, that is, every the number of bytes and
each byte of the file is the same as the source file.  When you
transfer in "text/ASCII" mode, it is assumed that the file is a text
file, and the exact byte contents of text files vary between
platforms, especially end-of-line characters which can be either "\n",
"\r", "\r\n" (I might got the ordering wrong).  In "text" mode, the
byte contents is modified to meet the receivers platforms, so
typically some bytes are added or removed at the end of each text
line.

I your case the Excel file is certainly not a text file, but it was
interpreted as such by download.file() and some of its bytes where
interpreted as end-of-line characters and translated.

The above does not only apply to R but many other transfer protocols, e.g. FTP.

/H