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).
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.
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.
5. This will open RStudio and you can proceed with your analysis.
-
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).
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.
5. This will open RStudio and you can proceed with your analysis.
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:
If you use the new Analyses tab display, your files will display under Your Analyses.
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.