Part of Using RStudio in the NHS England Secure Data Environment
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:
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:
- Select File.
- Select New File and then R Script from the drop-down menus.
- After you have typed the code, select File to save it.
- Select Save from the drop-down menu.
- Select the folder where you want to save the file.
- Enter the name for the file.
- Click Save.
The file will be saved in the folder selected.
Opening a saved file
To open a saved file and re-use the code:
- Select File.
- Select Open File from the drop-down menu.
- Select the folder and the file to be opened.
- Click Open.
Last edited: 12 February 2025 12:37 pm