opts <- list(
proxy = "999.999.999.999",
proxyusername = "mydomain\\myusername",
proxypassword = "mypassword",
proxyport = 8080
)
getURL("http://stackoverflow.com", .opts = opts)
Original source: Proxy setting for R
There is also a Mac (and presumably Linux) version of the answer there. I would just leave this as a comment but we have multiple unanswered questions on this error so we need to get one with an answer and then dedupe the others.
When using a different function still include .opts = opts or use the other version of the solution in the linked post, which was
1) Open Terminal and do the following:
export http_proxy=http://staff-proxy.ul.ie:8080
export HTTP_PROXY=http://staff-proxy.ul.ie:8080
2) Run R and do the following:
Sys.setenv(http_proxy="http://staff-proxy.ul.ie:8080")