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

前端 未结 5 595
-上瘾入骨i
-上瘾入骨i 2020-12-17 03:43

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

  1. Proxy : 1ncproxy1
  2. Port : 80
  3. Loggin : MyLoGiN
  4. Pass : MyPaSs
  5. <
5条回答
  •  一生所求
    2020-12-17 04:15

    As @juba states, I think you want to set the http_proxy. From ?download.file:

    Usernames and passwords can be set for HTTP proxy transfers via environment variable http_proxy_user in the form user:passwd. Alternatively, http_proxy can be of the form "http://user:pass@proxy.dom.com:8080/"

    So, try: Sys.setenv(http_proxy="http://MyLoGiN:MyPaSs@1ncproxy1:80")

    Be aware though:

    These environment variables must be set before the download code is first used: they cannot be altered later by calling Sys.setenv.

    So you are best off calling it in your .Rprofile

提交回复
热议问题