...The R documentation for the download.file method explains how to configure R to use an HTTP proxy. In short this requires adding one or more environment variables to your installation to point to the proxy.

To set the required environment variables you should add them to the R environment file (which is read by R at startup). On RStudio Server this file is found at R_HOME/etc/Renviron.site. On RStudio Desktop this file is found in the user home directory at ~/.Renviron.

You can easily access your .Renviron file by running the command file.edit('~/.Rprofile') within RStudio

Note that these files might not exist in the default installation of R so you may need to create them if they aren't already present.

Example environment file entries for proxy configuration might be:


Note that the http_proxy_user entry need only be supplied if the proxy requires authentication. There is also an ftp_proxy entry which can be specified for FTP transfers. You can consult the download.file documentation for detailed information on all available proxy options.

These environment variables are read once during the first call to download.file so if you have running R sessions you'll need to quit and restart them for the proxy behavior to take effect.

To see diagnostic information for HTTP transfers you can set the internet.info option to 0 or 1 (the default is 2, which only shows diagnostics for failure cases). For example:

options(internet.info = 0)