[R] problem with loadURL -- claims newer version used- fixed

Prof Brian Ripley ripley at stats.ox.ac.uk
Tue May 11 09:02:26 CEST 2004


On Mon, 10 May 2004, William Revelle wrote:

> >big5r.txt is delimited by CR not LF, and as R writes it as a binary file,
> >that's not the file that got saved.
> 
> Thanks.  That was the problem.  I was transferring the files from my 
> Mac to my web server (also a Mac) using Interarchy.  It was putting 
> in CRs rather than LFs (the Interarchy options were "old Mac cr" vs. 
> Unix (lf)").  Changing that transfer option makes it work.
> 
> >
> >Same problem with the header on big5r. 
> >
> >Try some octal dumps and find out which step is changing the file.
> >
> >BTW, I would use load(url(someURL)) these days.
> 
> load(url(someURL))  works (once I fixed the transfer to the server), 
> although I used the other form because I was following the help for 
> load. Perhaps the ?load comments could be modified to suggest 
> load(url(someURL)) instead of suggesting loadURL(someURL).

They don't suggest loadURL (that page is also ?loadURL).  What they say is

     'load' can load R objects saved in the current or any earlier
     format.  It can read a compressed file (see 'save') directly from
     a file or from a suitable connection.

     'loadURL' is a convenience wrapper which downloads a file, loads
     it and deletes the downloaded copy.

A `suitable connection' can include a call to url(), and that has the 
advantage (and possibly also disadvantage on a flaky connection) of not 
making a local copy.

I will add a warning about needing to preserve binary files, though.

-- 
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