Configuring R/R Studio in Virtual Computer Services (VCS)
Modified on: Thu, 23 May 2024 9:40 AMIntroduction
This article discusses configuring R/R Studio library for package installation on Virtual Computer Services (VCS).
Applicability
This article applies to R/R Studio on a standard VCS desktop, as well as a Data Analytics Research Core (DARC) VCS desktop.
Details
There are two methods for configuring R/R Studio libraries on VCS.
1) Use the built-in package library with close to 300 most popular packages pre-downloaded and installed on the image. *Recommended method*
2) Create the custom package library specific to the user. Any package to be used will need to be downloaded and installed.
Method #1
**As of November 19, 2023, Method #1 has changed, and is now simpler to use R packages. They are now built into R Studio, so there is no need to setup an environment variable pointing to C:\RStudio_Packages. If you've set this up in the past, this environment variable R_Libs_User will need to be deleted instead of creating it. **
Open Control Panel-> User Accounts -> Change my Environment Variables
Create a user environment variable called R_LIBS_USER with a value of C:\RStudio_Packages
Click Ok to save the changes. The packages will be available within R Studio for use.
Method #2:
The default workspace location for R and RStudio is the user’s My Documents (i.e. c:\users\%username%\Documents\R) . On the virtual desktop this is a redirected folder (\\MED-VCS-USRDATA\xendesktop\%username%\documents) and R/RStudio does not work with a UNC path. This prevents the user from installing library packages. In order to work around this issue, we must change where the default workspace points to and change to a mapped drive.
If the user still wants to store the library in their Documents folder, a mapped drive will need to be created and point to that location. Typically the drive letter of R: has been used in the past.
So mapping the drive letter R: to \\MED-VCS-USRDATA\xendesktop\%username%\documents will provide them with a drive letter to use with their environment variable.
Open Control Panel-> User Accounts -> Change my Environment Variables
Create a user environment variable called R_LIBS_USER with a value of R:\
Click Ok to save the changes. The packages will be available within R Studio for use.
Keywords: VCS,Virtual Computer Services,R,R Studio,packages,library