Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to install R packages via proxy [user + password]

Tags:

r

I need authentication to use internet, say these are my variables:

  1. Proxy : 1ncproxy1
  2. Port : 80
  3. Loggin : MyLoGiN
  4. Pass : MyPaSs

How can I install a package in R and its addon packages ? Such that the following would work:

install.packages("TSA", dependencies=TRUE)

Without our having internet connection failutes?

I tried this:

Sys.setenv("ftp_proxy" = "1ncproxy1","ftp_proxy_user"="MyLoGiN","ftp_proxy_password"="MyPaSs")#Port = 80

ButI get :

Warning: unable to access index for repository http://cran.ma.imperial.ac.uk/src/contrib
# or 
cannot open: HTTP status was '407 Proxy Authentication Required'

Many thanks,

like image 388
DKK Avatar asked Jan 25 '13 14:01

DKK


1 Answers

You are probably on Windows, so I would advice you to check the 'R on Windows FAQ' that came with your installation, particularly Question 2.19: The Internet download functions fail. You may need to restart R with the --internet2 option (IIRC) for the proxy settings to come into effect.

I always found this very cumbersome. An alternative is to install a proxy-aware webdownloader as eg wget (as a windows binary) where you set the proxy options in a file in your home directory. This is all from memory, I think the last time I was faced with such a proxy was in 2005 so YMMV.

like image 141
Dirk Eddelbuettel Avatar answered Sep 28 '22 07:09

Dirk Eddelbuettel