title: How do I tell the R interpreter how to use the proxy server?
body: <p>I'm trying to get R (running on Windows) to download some packages from the Internet, but the download fails because I can't get it to correctly use the necessary proxy server. The output text when I try the Windows menu option <strong>Packages</strong> > <strong>Install package(s)...</strong> and select a CRAN mirror is:</p>
  
  <blockquote>
    <p><code>&gt; utils:::menuInstallPkgs()</code><br>
    <code>--- Please select a CRAN mirror for use in this session ---</code><br>
    <code>Warning: unable to access index for repository http://cran.opensourceresources.org/bin/windows/contrib/2.12</code><br>
    <code>Warning: unable to access index for repository http://www.stats.ox.ac.uk/pub/RWin/bin/windows/contrib/2.12</code><br>
    <code>Error in install.packages(NULL, .libPaths()[1L], dependencies = NA, type = type) :</code><br>
    &nbsp;&nbsp;&nbsp;&nbsp;<code>no packages were specified</code><br>
    <code>In addition: Warning message:</code><br>
    <code>In open.connection(con, "r") :</code><br>
    &nbsp;&nbsp;&nbsp;&nbsp;<code>cannot open: HTTP status was '407 Proxy Authentication Required'</code></p>
  </blockquote>
  
  <p>I know the address and port of the proxy, and I also know the address of the automatic configuration script. I don't know what the authentication is called, but when using the proxy (in a browser and some other applications), I enter a username and password in a dialog window that pops up.</p>
  
  <p>To set the proxy, I tried each of the following:</p>
  
  <ul>
  <li><code>Sys.setenv(http_proxy="http://proxy.example.com:8080")</code></li>
  <li><code>Sys.setenv("http_proxy"="http://proxy.example.com:8080")</code></li>
  <li><code>Sys.setenv(HTTP_PROXY="http://proxy.example.com:8080")</code></li>
  <li><code>Sys.setenv("HTTP_PROXY"="http://proxy.example.com:8080")</code></li>
  </ul>
  
  <p>For authentication, I similarly tried setting the <code>http_proxy_user</code> environment variable to:</p>
  
  <ul>
  <li><code>ask</code></li>
  <li><code>user:passwd</code></li>
  <li>Leaving it untouched</li>
  </ul>
  
  <p>Am I using the right commands in the right way?</p>