[R] Comment on loadURL: should default to mode="wb"

Prof Brian Ripley ripley at stats.ox.ac.uk
Sat Feb 19 07:42:03 CET 2005


On Fri, 18 Feb 2005, Seth Falcon wrote:

> So the help for loadURL says:
>
>     'loadURL' is a convenience wrapper which downloads a file, loads
>     it and deletes the downloaded copy.
>
> Trying to load an rda file on Windows (XP, R-devel) I was surprised
> when I received an error about input being corrupted with LF
> replaced by CR.
>
> The fix was to specify mode="wb" to loadURL.  This gets passed to
> download.file and the right thing happens...
>
> On unix platforms it doesn't matter whether mode="w" or mode="wb".
>
> Will loadURL ever do anything useful on Windows without passing
> mode="wb"?  If not, I think changing the default (in loadURL) to
> mode="wb" would be a nice improvement.

Yes of course, as almost all Web files are text and the default is correct 
for them.

Why are you using an out-dated interface anyway?  See the examples for 
loadURL!

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595




More information about the R-help mailing list