R Language Configuration for the Proxy
If you use the open-source R statistical programing language, you can configure it to carry out HTTP or HTTPS proxy requests. R has distributions that can be run in Windows, Linux, and Mac.
You'll need to point to the proxy by adding one or more environment variables to your installation. Add the environment variables to the R environment file.
- On RStudio Server, the filepath is
- On RStudio Desktop, the filepath in the user home directory is
- Access your .Renviron file by running the command
If these files don't exist in the default installation of R, you'll need to create them.
Here are examples of environment file entries for proxy configuration:
- Note that HTTPS requests require extra work to make use of custom headers.
- The R package "RCurl" provides more comprehensive facilities to download data from URLs.
You'll find more information at:
- Configuring R to Use an HTTP or HTTPS Proxy: Includes links to related articles from R Studio.
- Download File from the Internet : Documentation for an R language method which includes guidance on Linux and Windows, and methods for cURL, libcurl, and Wget.
- Running RStudio Server with a Proxy: A range of traffic-handling configurations for running RStudio Server behind a proxy.
- Proxy setting for R: A troubleshooting forum that addresses several issues related to R with proxies.
R with Web Browsers
For web browsers, you must use IP address authentication, then configure your network proxy settings. If you use Firefox or Chrome, the FoxyProxy plugin makes it very easy to configure your proxy settings.
You'll find more information in our article How to Change Web Browser Proxy Settings.
For testing, the article referenced above, How to drive a Web browser with R (and RSelenium), includes detail on how to set up R Studio to open several different browsers in succession.
R and Selenium
For automated testing, the R Studio provides a link to install the Selenium 2.0 WebDriver. Here is a link to a general how-to: How to drive a Web browser with R (and RSelenium).
The "RSelenium" package, with a complete set of R language bindings for Selenium WebDriver 2.0, is available as a PDF.
Scraping with Selenium discusses a variety of ways R and Selenium can be used together with a proxy.