[R] Problem downloading webpages using batchfiles and RCurl from command line in Vista Basic - couldn't connect to host

Gabor Grothendieck ggrothendieck at gmail.com
Tue Jun 2 17:52:06 CEST 2009


On Tue, Jun 2, 2009 at 7:09 AM, Tony Breyal <tony.breyal at googlemail.com> wrote:
> Dear all,
>
> I am having a problem downloading webpages through R when i run it in
> the DOS window under Windows Vista Basic. I have downloaded the
> batchfiles from http://code.google.com/p/batchfiles/ and have
> successfully set the PATH.

You don't need to set your PATH if you use batchfiles.  Their
purpose is avoid having to do that in the first place.    That
may not be related to your main problem though.

>
> I open up 'Command Prompt' in Vista and type (after the C:\...>
> stuff):
>
> ### START ###
> C:\Users\Karen>Rscript -e "library(RCurl); getURL('http://
> www.google.com')"
> Loading required package: methods
> Loading required package: bitops
> Error in curlPerform(curl = curl, .opts = opts, .encoding
> = .encoding) :
>  couldn't connect to host
> Calls: getURL -> curlPerform -> .Call
> Execution halted
> ### END ###

Here are two things to try:

1. Just a guess but you may need to run this elevated.  Using
el.js from the batchfiles:

el cmd

and allow it to proceed when asked.  That
will spawn a new window from which everything will run in
elevated mode.  Try your Rscript command in that.

2. Another thing to try is running without using the batchfiles.
Go into R and enter this:
 file.path(R.home(), "bin", "Rscript.exe")

and it will give you the path to Rscript.exe.  Using that path
try this:

"...whatever.../Rscript.exe" -e ...your command...




More information about the R-help mailing list