Using R in MCECS

Configuring RStudio in MCECS

 

The first time you run RStudio in MCECS you must configure it. This simple process  involves configuring RStudio to find and use an appropriate version of R. When you start RStudio, the popup will ask you to “Choose  a specific version of R.”

Window to choose R installation

 

Use Browse to specify the folder: P:\Programs\R\R

File explorer window for R

 

Choose an appropriate version to use (most likely 64‐bit)

Window to choose version of R

 

That’s it!  You will not have to repeat this step. If however, you decide you need to change the  version of R you are using, you can do that under Tools; Global Options; Change

Options window to change version of R

 

Working Directory and Library Folder

Two other changes you should make are to your Default Working Directory and Library Folder.

Again under, RStudio; Tools; Global Options, set your Default Working Directory by using  Browse to find (you may need to Create a new Folder called R) N:\My Documents\R

RStudio options window

 

Second, to change your Library Folder, first create a new Folder on your N: drive called RLIBS
Eg.   md N:\RLIBS
Next, create an Environmental Variable called R_LIBS and set it to the folder N:\RLIBS
Eg.  set R_LIBS=N:\RLIBS  
To set the variables permanently, open the start menu and search environment. This will launch the Environment Variable editor.
Then click on new, enter the Variable name and corresponding value like shown.

Environment variable window

 

Please avoid using UNC Pathnames with R and RStudio

UNC Pathnames of the form eg. \\THOTH\HOME\USERNAME or “DESKTOP” are not supported  by R and RStudio and are known to cause problems.

 

Resetting your R Environment

If your RStudio User Configurations becomes messy or corrupt and things stop working as  expected, you can Reset them using our FIXIT scripts. Find on the Start Menu.
Start; Programs; General Applications; Fix It  Find RStudio in the list and press “Fix It”

Environmental variables window