[R] source and localhost

Prof Brian Ripley ripley at stats.ox.ac.uk
Fri May 20 17:42:59 CEST 2011


On Fri, 20 May 2011, Uwe Ligges wrote:

>
>
> On 20.05.2011 17:22, Thomas.Bock at ptb.de wrote:
>> Dear List,
>> 
>> I have problems with the function source() using a
>> url of the kind:
>> 
>> http://localhost:5984/path/fn.R
>
> Does
>
> con <- url("http://localhost:5984/path/fn.R")
> source(url)
> close(con)
>
> work for you?
>
> Please read ?source carefully and note it uses a file() connection as the 
> default unless you specify another connection explicitly..

Correct, but ?file says

      For ‘file’ the description is a path to the file to be opened or a
      complete URL (when it is the same as calling ‘url’), ...

so this works in principle (and in practice for me: 
source("http://www.stats.ox.ac.uk/~ripley/APTS2010/slice.R") ). So the 
issue is something peculiar to the URL. Maybe try download.file on it 
with options(internet.info=0) to get maximal info.

>
> Uwe Ligges
>
>
>
>
>> I receive
>> 
>> Fehler in file(file, "r", encoding = encoding) :
>>    kann Verbindung nicht öffnen
>> Zusätzlich: Warnmeldung:
>> In file(file, "r", encoding = encoding) :
>>    Öffnen fehlgeschlagen: HTTP Status war '502 cannotconnect'
>> 
>> The url itself is ok since I can:
>> - use a browser
>> - use curl
>> - use download.file() function
>> - use getURL() (out of Duncans RCurl)
>> 
>> furthermore it works, when I use the full host + domain name.
>> So I think it is about dns stuff. I get a nice:
>> 
>>> Sys.getenv("no_proxy")
>> [1] "localhost, 127.0.0.1"
>> 
>> and work on 32bit opensuse 11.4 with
>> R version 2.13.0 (2011-04-13)
>> 
>> Can someone give me a hint?
>> Best regards
>> Thomas
>> 
>> ______________________________________________
>> R-help at r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide 
>> http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

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