You may wish to set the temp directory to a seperate location, rather than the default /tmp location. This can be for a variety of reasons, but primarily, as more user sessions need to create files in the temp directory, it makes sense to move this to a larger filesystem.
You can run the tempdir
function in R code which shows you where your current temp directory is:
tempdir()
A potential solution is to set this in your R environ file by modifying $R_HOME/etc/Renviron. However, there is another method that proves more effective because:
- This method sets it across all R versions
- This method only sets it for Posit Workbench product
First, modify the rsession-profile configuration file
vi /etc/rstudio/rsession-profile
Add the following line to this file
export TMPDIR=/path/to/directory
Where /path/to/directory is the path to the temp directory that you wish to change. From there, modify the permissions on the file to be readable by the rstudio-server process.
chmod 755 /etc/rstudio/rsession-profile
Lastly, restart the Workbench process:
sudo rstudio-server restart
Comments