Using and launching RStudio with .Rmd files

Allie Cliffe
  • Updated

You can keep your RStudio analysis by saving as an R-Markdown file (.Rmd) in the Analyses tab of your workspace. Read on for the basics of launching RStudio from an .Rmd file and how to save, store, and delete in your workspace. 

Note: Terra only recognizes R-Markdown files with the extension .Rmd. The capital 'R' is required. 

Launching RStudio from an .Rmd file

All created and saved .Rmd files are listed under Your Analyses in the Analyses tab of your workspace. You can identify them by the "R" logo beside the filename (Analyses tab view only). 
R-markdown-files-in-Analyses-tab_Screen_shot.png

If you use the old (Notebooks) tab displayRStudio files will not show in the Notebooks tab. We suggest switching to the new Analyses tab display. Otherwise, you can start an RStudio Cloud Environment and open your file from RStudio by selecting File > Open file from the menu. 

Step-by-step instructions

If you have saved R-Markdown files, you can create and launch an RStudio analysis by clicking on the file card in the Analyses tab. See step-by-step directions below.

  • 1. Click on the .Rmd file to open in the Name column.

    2. Click the Open button beside the Preview (Read only) tab. 

    3. In the RStudio Cloud Environment pane, click Create
    Launch-RStudio-from-Rmd-file_Create-Cloud-Environment_Screen_capture.gif
    The RStudio environment will take three-four minutes to create. Once it's ready, you'll see a green dot below the R logo in the sidebar. 

    4. Once your RStudio Cloud Environment is running, click the Open RStudio button.
    Open-RStudio-button_Screen_shot.png

    5. This will open RStudio and you can proceed with your analysis. 
    RStudio-instance_Screen_shot.png

  • 1. Click on the .Rmd file to open in the Name column.

    2. Click the R logo in the sidebar to resume the RStudio Cloud Environment.  

    3. Click Resume Environment (play icon). 
    Re-start-RStudio-from-Rmd-file_Screen_capture.gif
    The RStudio Cloud Environment will take a minute or two to resume.

    4. Once the environment is running (green dot in the sidebar), close the RStudio Cloud Environment pane ("x" at top right) and click the Open RStudio button.
    Open-RStudio-button_Screen_shot.png

    5. This will open RStudio and you can proceed with your analysis. 
    RStudio-instance_Screen_shot.png

Saving RStudio analyses (autosave and more)

Save any code you write in your Terra RStudio instance by creating a new file of the appropriate filetype. Running code in the console is a fine way to test the code, but to export your code or save it to another location, you need to explicitly create and save a file containing the code.

You can save your work as an R-Markdown (.Rmd) file from the File menu at the top of your RStudio instance:

RStudio_Save-file_Screen_shot.png

If you use the new Analyses tab display, your files will display under Your Analyses.
RStudio-.Rmd-file-in-Analyses-tab_Screen_shot.png

Autosave

To make sure you don't lose your work, Terra autosaves R-Markdown files every 10 seconds (by default) to workspace storage (Google bucket). 

  • Background sync to workspace storage and PD (changes persist)
  • Indicated by the color and content below the RStudio logo (top left)

To change the default autosave period, go to Options > Settings > Save

Deleting unwanted .Rmd files

Delete all files in Terra (Analyses tab)When you finish your analysis and want to delete extra .Rmd files, delete them from the Analyses tab in Terra, not the RStudio instance. This keeps Terra from overwriting deleted files with an autosaved version.

Was this article helpful?

0 out of 0 found this helpful

Have more questions? Submit a request

Comments

0 comments

Please sign in to leave a comment.