Workspaces allow you to export or copy data stored in a table in your workspace database to a file on the file system. This is especially useful if you are using a data analysis tool that requires data inputs as files rather than a connection to a database. For example, you may choose to use an R library that prefers to operate on file-based data rather than data held in a database.
To export or copy data to a file, select your data table on the Datasets tab, and click the 'Export to datafile' button on right-hand sidebar.
A dialog will appear, giving you the following options to customise how the data is written to the new file:
- New datafile name: The name of the file that the data is written to – the extension for this new file must be .csv.
- Delimiter: The character to use as the delimiter in the new file.
- Number of rows: The number of rows to write to the file.
- Include header row: Controls whether the column headers are written to the first row of the new file.
Click the 'Export' button to start writing the data to the new file.
When the process is complete, a notification will appear in the workspace activity stream.
The new file is written to the Datafiles folder in the workspace. You can access this folder by using system() commands in the R console.