Skip to content

RStudio

R with RStudio is one of the key tools in the Desktop view. You can access it using the Applications menu in the bottom left hand corner, R is under Graphics and RStudio is under Development.

The current installed version of R is 4.0.5. For more information on installing and accessing other versions of RStudio, see "Other software."

Image requires alt text

Start R-Studio

You will now have an RStudio session open and this should work as you would expect.

Image requires alt text

R-Studio open session

To add data to your RStudio session you can get data in the usual way from the local areas on the VM. This data you will have added to the VM through the methods described in "Uploading data."

There are a number of Shortcuts that can be used with RStudio. These shortcuts involve using the Shift button please avoid the Shift being the first key pressed. For example by using this order

Ctrl+Shift+R

You will open a new terminal (the order listed in the shortcuts help page is Shift+Ctrl+R). The following shortcut keys for RStudio seem to work fine, whereas some others don't. This is under investigation and is related to shortcuts in the browser window. The following keys seem to work, using Firefox 73.0:

  • Alt+Shift+G
  • Alt+Shift+K
  • Alt+Shift+T
  • Ctrl+Shift+1

You can also use R directly this will give you the normal command line access to R.

Adding Packages to R and RStudio

One of the major benefits of the Analytical Workbench is the freedom to add whatever R packages you need to use when you want to use them. Packages should mainly be installed from CRAN aka Comprehensive R Archive Network.

Image requires alt text

CRAN Package Repository for R

There are many packages available on CRAN that provide a wide range of functionality to R. There are two ways you can install these packages to R.

The first way is to use the dropdown menu to install a package from CRAN. From the Tools menu select Install Packages…

Image requires alt text

R-Studio open session

This will give you a dialogue box into which you can type the package you want. RStudio will help you to find the package as you type. Please note it might take some time to install the package depending on how large it is. You will see text in the console showing the package being installed. When it says that 'The downloaded source packages are in' you know it has finished.

Image requires alt text

Selecting a package to install

Image requires alt text

Console output after installing a package

Another to install packages is directly in the console within RStudio. Type install.packages("NameOfPackage") to install the package from CRAN. It is also possible to install R packages using the command line version of R, and also within your own anaconda environments, if using Conda.