R and RStudio using External Access rules
This method of downloading R packages is outdated! This article will not be updated any longer.
IP addresses are often subject to change. Therefore, the domain allowlisting feature has been introduced and it is self-service for Accountable and Privileged Members!
For instruction on using R and RStudio using the domain allowlisting feature (i.e., internet access based on domain instead of IP), see R/RStudio installation using domain allowlisting.
R is an open-source programming language often used by researchers and data scientists to manipulate, prepare, analyse and visualize data. RStudio is often used as the preferred IDE to write and run R code in. Some Windows VMs deployed in DRE workspaces come with R and RStudio preinstalled. If R/RStudio is not available on your VM, refer to
How do I install R and RStudio? on the bottom of this article.
The first part of the article focusses on how to make R packages available in the VMs of your workspace, which requires some one-time manual action by workspace Owners. We discuss CRAN packages (relevant for almost all R users) and Bioconductor packages (relevant for some R users) separately.
Making CRAN packages available in your workspace
Beware: Until the instructions in this section have been followed, CRAN packages are not available.
Only Owners can make packages available for the workspace
R code often depends on CRAN packages that are normally available on the internet. However, DRE workspaces are by default not connected to the internet, which means that packages are not available without taking some one-time manual action. In this article, we explain the steps that an Owner needs to perform to make CRAN packages available within their workspace. It is a two-step process:
First, they need to create and activate External Access rules in the workspace;
- Then, they need to change a settings file (Rprofile.site) in the R installation of each the VM(s)
If you follow the instructions below carefully, all workspace members should be able to load and install packages on the VM(s) going forward.
Step 1: Create and activate External Access rules
Option 1: First go to the myDRE portal, to your workspace and then to the External Access tab. Here, you need to create and activate two different External Access rules to make CRAN packages available:
Rule | IP address | Port | Reason |
CranRProject443 | 137.208.57.37 | 443 | Access to cran.r-project.org |
CranRProject80 | 137.208.57.37 | 80 | Access to cran.r-project.org |
For each rule:
- Click on the Add Rule button in the External Access tab.
In the pop-up, fill in the details as shown above and click on Save.
- Enable the rules.
These two rules allow connections from the VMs in your workspace to a CRAN repository mirror hosted at r-project.org.
To learn more about External Access rules, refer to our article on Opening up ports.
Option 2: External access to CRAN repository mirror can also be configured using
domain allowlisting.
Submit a ticket to your Support team member requesting opening access to
R and RStudio related domains. Please do not forget to mention your workspace name in the request.
When using this option, please follow further the R/RStudio specific instructions here. Step 2: Change the Rprofile.site file of your R installation
On each of the VMs in your workspace, you need to change the Rprofile.site file. This will change the standard settings of your R installation, so that it will automatically use the CRAN mirror that you made accessible in step 1.
You can choose to change the file manually, or to replace the existing file with one that we've attached to the current article.
Beware: You need to change the Rprofile.site file on each VM separately.
Option 1: Change the Rprofile.site file manually
- Connect to the VM
- Inside the VM, search for Wordpad > Right-click > Click on Run as administrator
- In Wordpad, click on File > Open
- Browse to C:\Program Files\R\R-[Version]\etc
- Select Rprofile.site and click on Open
- On the bottom of the file, add the following line (without a '#'):
- Click on Save and then on Close.
Option 2: Replace the existing Rprofile.site file
- Download the attached Rprofile.site file (see bottom of the current article)
- Upload the file to your workspace
- Connect to the VM
- Inside the VM, open file explorer
- Find your uploaded Rprofile.site file > Right-click > Click on Copy
- Browse to to C:\Program Files\R\R-[Version]\etc
- In this folder, right-click > Click on Paste
- Approve that the file is overwritten
You should now be able to install CRAN packages
If you carefully followed the instructions above, you should be able to install packages in R. We strongly advise to install packages in ADMIN mode (right click R or RStudio, run as admin), as this ensures the installed packages are available for any user accessing the Windows VM.
- Find Rstudio in the startmenu, right -click > More > click on Run as administrator;
- Install the required packages with:
install.packages(<packages>)
If you find that you're still experiencing problems with installing packages, you can also include the line from Step 2 in your code:
Still not working? Add a ticket and ask for assistance of the Core Support Team.
Making Bioconductor packages available in your workspace
Beware: Until the instructions in this section have been followed, Bioconductor packages are not available.
Only Owners can make packages available for the workspace
Apart from CRAN packages, you may also want to use Bioconductor packages. Just like for CRAN packages, Owners need to (1) create and enable some External Access rules and (2) adjust the Rprofile.site file. Additionally, they need to (3) add a config.yaml file. The instructions below require you to make use of the most recent Bioconductor (v3.15), which only works with R v4.2.0. Refer to the How do I install R and RStudio? to learn how to (manually) install this version if it's not yet available. Step 1: Create and activate External Access rules
Step 2: Change the Rprofile.site file of your R installation
You need to add a couple of lines to the Rprofile.site file:
options(BIOCONDUCTOR_ONLINE_VERSION_DIAGNOSIS = FALSE)
options(BIOCONDUCTOR_CONFIG_FILE = "C:/Program Files/R/R-4.2.0/etc/config.yaml")
You can choose to add them by yourself manually, or to use the Rprofile.site file attached to the article (which includes both the CRAN line and these lines). For instructions, refer to
step 2 of the CRAN section.
Step 3: Add config.yaml file
Lastly, you need to add a config.yaml file which is specific to Bioconductor versions.
- Download the attached config.yaml file (suitable for version R v4.2 and Bioconductor v3.15)
- Upload it to your DRE workspace
- Connect to a VM in the workspace
- Inside the VM, open file explorer
- Find your uploaded config.yaml file > Right-click > Click on Copy
- Browse to to C:\Program Files\R\R-4.2.0\etc
- In this folder, right-click > Click on Paste
You should now be able to install Bioconductor packages
We recommend to use install.packages() to install Bioconductor packages. We also strongly advise to
install packages in ADMIN mode (right click R or RStudio, run as admin), as this ensures the installed packages are available for any user accessing the Windows VM. For instructions, see the
corresponding paragraph in the CRAN section.
How do I install R and RStudio?
These steps you perform on your own desktop.
There might be a software share available.
You can install R and RStudio by yourself or via available application managers/software stores, depending on the template of your VM.
[volgorde van installaties neerzetten]
Install via application manager/software store
If there's an app manager or software store on your VM, R and RStudio are likely included. For instructions on how to use the managers/stores, refer to the institution-specific articles:
- Software store UMC Utrecht (only accesible when logged into myDRE support)
Self-service installation
The benefit of installing in this way is that you have full control over which versions you use.
- Tip: You can directly download R and Rtools via this link within the VM, if the external access rules as described above have been added and enabled.
- (if not following the tip) Upload the .exe files to your workspace by drag and dropping them in the Files tab.
- Connect to the VM.
- On the VM, right-click on the executables > Run as administrator.
- Follow the installations steps.
Related Articles
R/RStudio installation using domain allowlisting on Windows VMs
First version: 2022-08-22 Last version: 2023-12-15 Last change: Added an alternative for installing packages from Github (installation from manually downloaded repository). This is a community effort. The article was created by the anDREa Support ...
External access in your workspace
Introduction By default myDRE workspaces do not have connection to the internet. This ensures that data within the workspace is secure and auditable - we know what comes in, and what goes out. However, sometimes you do need a connection to a web ...
Castor R-Package
Prerequisites DRE: Owner access to workspace, to install R / RStudio / Rtools in a virtual machine External access to CRAN in the workspace where you want to export the data to (open up port rule) External access to Castor in the workspace where you ...
Installing R and Bioconductor packages
Recently some users experienced issues with accessing R-packages and Bioconductor-packages. The article R and RStudio has been rewritten in order to easily install R and Bioconductor-packages in your Workspace.
Windows-RUMC-RPython 1.0.0
Important! This image may only be deployed in Radboudumc workspaces. It is not permitted to deploy the template in a workspace of a different tenant. Thanks for understanding. The Windows-RUMC-RPython template is based on the Windows-RUMC-Base 2.0.0 ...