Skip to main content

Current Chapter

Current chapter – Working with files and data


Saving data

You can save projects, files, plots, scripts, job logs and other output files to personal and shared folders within RStudio. Code can be saved and opened later for re-use.


Personal folders

When you open a new session within RStudio, the working directory will, by default, be mapped to your Home folder. This folder is specific for each individual and for each research project.

The contents of your Home folder can only be viewed by you. If you wish to share code or data between users in the same research project, working directories should be stored either on GitLab or within the collaboration drive (Z:), which can be accessed from the VDI’s desktop:

Collaboration drive image


Saving code to a text file

You can type code directly into the Console window or a text file and then run the code in the Console window.

Code that you have typed into a text file can be saved and then re-used in a separate session.

To create a text file to type your code in:

  1. Select File.
  2. Select New File and then R Script from the drop-down menus.

R Studio New file R Script tab screen

  1. After you have typed the code, select File to save it.
  2. Select Save from the drop-down menu.

RStudio save screen

  1. Select the folder where you want to save the file.
  2. Enter the name for the file.
  3. Click Save.

RStudio save data desktop screen

The file will be saved in the folder selected.


Opening a saved file

To open a saved file and re-use the code:

  1. Select File.
  2. Select Open File from the drop-down menu.
  3. Select the folder and the file to be opened.
  4. Click Open.

Last edited: 12 February 2025 12:37 pm