[R] Comment on loadURL: should default to mode="wb"
Prof Brian Ripley
ripley at stats.ox.ac.uk
Sat Feb 19 07:56:19 CET 2005
A bit more explanation.
On Sat, 19 Feb 2005, Prof Brian Ripley wrote:
> 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.
That *is* described on the help page for loadURL.
>> 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.
On Windows.
> Yes of course, as almost all Web files are text and the default is correct
> for them.
That means ASCII=TRUE saves. When loadURL was written, they could be
transferred as text file.
> Why are you using an out-dated interface anyway? See the examples for
> loadURL!
The modern interface does work on Windows:
> load(url("http://www.stats.ox.ac.uk/pub/bdr/hills.rda"))
no error (and I have removed the file).
--
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