Page tree

The RStudio interface

Once you have started your RStudio session and connected to it, you should see something like the following:



On the left-hand side you have a single panel, which is the interactive Console pane. While you can write interactive code here, you probably want to actually work with an R script. To start a new script, select File → New File → R Script from the menu bar. You should then end up with your interface looking like this:



You now have a source pane at the top left, where you can write your script. Use File→Save to save your script.

Running Code

To actually run some R code, type into the source pane (or load an existing R script). Then select the (portion of) code that you want to run, and click the Run button on the top edge of the source pane (or use Code → Run Selected Line(s) from the menu). You should end up with something like this:

Note that you can see the code you ran in the Console pane bottom left, and the variables that are now instantiated in the Environment pane top right.

Using Additional Packages

Enabling System-supplied packages

Many additional packages are already available in the system library. To use these, select the Packages tab in the bottom-right pane. Then find the packages you want (either by scrolling or using the little searchbox in the ) and tick the ones you wish to enable:

You will see the commands needed to use these packages appear in the Console pane; you can copy and paste them into your R scripts as needed.

Installing additional packages

  • Note - this can only  be done if the RStudio session is launched in a queue with internet access, eg the copyq or analysis queues. It will not work from the standard compute queues at this time.

If you need a package which is not available in the system library, it is possible to install extra packages using the Install button in the Packages tab:


Once installed, the package will become available in the User Library section of the Packages tab, and can be selected there:

You can now use the installed package in your own scripts using the library(...) syntax - you don't need to run the install.packages(...) bit again.

Disconnecting and reconnecting your RStudio session

To disconnect from the session, you can just close the browser tab. To reconnect, click on the Connect to RStudio Server button within the job card on the Interactive Sessions page.

Note that only one browser tab can be connected to a session at one time; connecting from a new tab disconnects the session from any existing tabs, so it won't matter if you've left the session connected on a different computer.

Ending your RStudio session

It is not possible to exit the Gadi job from within the interface itself. For best results, use the 'power button' icon at the top right to close the current session, and then return to the Interactive Sessions page within the ARE interface, and delete the job from the job card there. Failing to delete the job from the Interactive Sessions page will result in the job continuing to run, up to the time limit specified when you submitted the job, which will waste SU.