If you use lots of R, you’ll be happy to know that Terra has integrated RStudio capabilities - you can spin up a cloud environment pre-configured to run the server version of RStudio right on the Terra platform. The integration is a result of our collaboration with the Bioconductor team as part of the AnVIL project.
- Richer IDE experience for R development
- Support for launching RShiny apps
- First-class Bioconductor support
- Includes variable explorer, R Markdown editor, debugger, terminal
- Git integration
This article covers the following aspects of using RStudio on Terra:
- How to Launch RStudio in Terra
- Using Terminal in RStudio
- Saving RStudio files
- Switching between RStudio and Jupyter Notebooks
How to Launch RStudio in Terra
To launch an instance of RStudio, go to a workspace where you’re able to launch your own cloud environments (e.g. “can compute”-level access). Click on the Cloud Environment widget at the top right of your screen and click on the Application Configuration drop-down menu. Scroll down to the “Community-Maintained RStudio Environments” section and select the latest available version of Rstudio. Once you’ve made the selection, press the “Update” or “Create” button at the bottom right of the widget.
The environment will take a few minutes to start up, but once it’s ready the widget will have a pause button next to an RStudio logo. All you need to do now to open your RStudio instance is click on the RStudio logo.
Using Terminal in RStudio
You can still use a terminal in a Terra-based RStudio instance, although since the terminal icon in the Cloud Environment widget has been replaced with the RStudio logo, you access the terminal in the way RStudio users traditionally do this - by clicking the "Terminal" tab to the right of the "Console" tab in the RStudio interface itself:
Saving RStudio files
When you save files using the RStudio interface, these files are saved to the "/rstudio" subdirectory of your "/home" folder on your persistent disk. Make sure you use the terminal to move these files if you're going to delete or replace your persistent disk when deleting or updating your cloud environment. For a more detailed understanding of where your files live within the Terra ecosystem, check out this article.
Switching between RStudio and Jupyter Notebooks
Remember that the RStudio application configuration is not compatible with the Jupyter notebooks listed in your Notebooks tab. If you try to open a Jupyter Notebook after you’ve created an RStudio environment, you’ll get a message prompting you to update your cloud environment to a Jupyter-based image.
However, if you've kept your persistent disk, once you've replaced your cloud environment with a Jupyter-compatible configuration, you should be able to open a notebook, open the terminal view into your virtual machine through that notebook, and see that the files you saved to your persistent disk are still there: