[R] source and localhost

Thomas.Bock at ptb.de Thomas.Bock at ptb.de
Fri May 20 17:45:11 CEST 2011


> 
> 
> 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?
No; I have tested it already.
> 
> Please read ?source carefully and note it uses a file() connection as 
> the default unless you specify another connection explicitly..

the man page says:

 file: a connection or a character string giving the pathname of the
          file or URL to read from.  ...

The point is that it works with:
 
source("http://host.domain.de: .../.../fn.R")

How can I specify another connection explicitly? With url, isn't it?
> 
> 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.



More information about the R-help mailing list