1

Environment: Windows 7, R 3.1.0

Our corporate proxy blocks interprocess communication for programs on the same machine (e.g. R <-> Cytoscape). If I hide the proxy ( e.g. avoid the internet2 library and remove the Windows 7 environment variables) and then start R the communication works fine. The people that control the firewall are reluctant to rewrite the rules that would let this traffic through.

Is there any simple mechanism within R to turn the proxy on and off at need within the same session? For example,

  • start R with proxy on,
  • do some updates, fetch some data from, say, KEGG
  • start Cytoscape
  • turn proxy off
  • use RCytoscape to drive Cytoscape
  • turn proxy on
  • and so forth.

I will be teaching some biologists to use this, so it needs to be dead simple. They are not comfortable with R as it is.

Jaap
  • 81,064
  • 34
  • 182
  • 193
Bill Raynor
  • 413
  • 1
  • 4
  • 10
  • Related, although it may not answer the same session question: http://stackoverflow.com/questions/6467277/proxy-setting-for-r and http://stackoverflow.com/questions/4832560/how-do-i-tell-the-r-interpreter-how-to-use-the-proxy-server – Andrie Jun 02 '14 at 13:32
  • Thanks, Andre. I've visited that page while hacking on other problems (e.g. using RCurlOptions for biomaRt to get **through** the proxy to the outside). R has multiple options for that (--internet2, library(httr), and RCurlOptions) all of which get through the proxy for some packages, but not all. Here the problem is telling R to _temporarily_ avoid the proxy. – Bill Raynor Jun 02 '14 at 13:55

1 Answers1

0

As of R version 3.2.0, the setInternet2 function can set internet connection settings and change them within the same R session. According to the NEWS, this was achieved by merging internet.dll with internet2.dll. From the help page (?setInternet2):

Prior to R 3.2.0 this loaded a new DLL: nowadays both versions of the functions are contained in ‘internet.dll’.

So switching should be possible without starting a new session.

setInternet2(TRUE)
setInternet2(NA) ## returns current value
## [1] TRUE

install.packages("zoo") ## Cause internet.dll to be loaded

setInternet2(FALSE) ## Would have thrown a warning message in R < 3.2.0
setInternet2(NA)
## [1] FALSE
BenBarnes
  • 19,114
  • 6
  • 56
  • 74