Launching RStudio in Terra by using community-maintained images

Anton Kovalsky
  • Updated

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.

For some additional context, check out our Terra Blog post on the subject, or watch this excellent video tutorial on using RStudio on Terra for analysis. Some perks of using RStudio include:

  • 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 

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.

rstudio1.gif

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.


Screen_Shot_2021-03-17_at_11.50.33_AM.png

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:

2021-03-26_0941.png

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.

Screen_Shot_2021-03-17_at_3.18.59_PM.png

 

In some cases, you may want to copy data from your interactive cloud environment to another location, to keep from losing work while deleting or modifying your persistent disk. For detailed instructions on copying files from your interactive environment to your workspace bucket, see 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.

Screen_Shot_2021-03-17_at_12.08.01_PM.png

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:

Screen_Shot_2021-03-18_at_12.58.10_PM.png

 

 

Was this article helpful?

1 out of 1 found this helpful

Have more questions? Submit a request

Comments

0 comments

Please sign in to leave a comment.