[R] ReadLines does not give results with urls

Luzie U. Wingen wingen.luzie at mh-hannover.de
Mon Jan 12 16:29:25 CET 2004


Hello,

I am using R version 1.8.1 on a linux machine (Suse 8.2.).
I have problems to use readLines() with urls.

This seems to be a problem with our proxy-server. 
Downloading files work with download.file() with wget but not without:

> download.file(url = "http://cran.r-project.org/src/contrib/PACKAGES", destfile = "test.txt", method = "wget", cacheOK = FALSE)
This works!

> download.file(url = "http://cran.r-project.org/src/contrib/PACKAGES", destfile = "test.txt", cacheOK = FALSE)
This does not work!

For readLines() there seems not to be the possibility to use wget.
So I can only read the local pages which are accessible without proxy-server
but not:

> readLines(url("http://cran.r-project.org/src/contrib/PACKAGES"))
This does give the following response after 60 sec:
>Error in readLines(url("http://cran.r-project.org/src/contrib/PACKAGES"),  : 
        cannot open the connection
>In addition: Warning message: 
>unable to connect to 'cran.r-project.org' on port 80. 

After reading the help pages I checked the http_proxy environmental 
variable, which seems to be OK to me:

> Sys.getenv("http_proxy")
    http_proxy 
		"http://proxy.mh-hannover.de:8080/" 
> Sys.getenv("no_proxy")
		no_proxy 
    "" 

Setting the options options(download.file.method="wget") helps
for download.file() but not for "readLines().

Does anybody has a further idea, how to manipulate readLines()
so that it uses the proxy-server?

Thank you

Luzie
-- 
Luzie U. Wingen, Institut fuer Zell- und Molekularpathologie,
Medizinische Hochschule Hannover, Carl-Neuberg-Str. 1, 30625 Hannover,
Tel.: (+49) 0511-532-9432, Fax: -4521, Email: wingen.luzie at mh-hannover.de




More information about the R-help mailing list