I am using R on windows and need to change the temporary directory where tmp files are stored.
I checked a few answers, here, in R-help, etc., but no one is working
For Linux, I'm using Ubuntu 18.04.1 LTS. You can try the following line:
write("TMP = YOUR_PATH_VARIABLE", file=file.path('~/.Renviron'))
Explanation: This line will write the TMP variable, which has been assigned to your own temp path, to the '.Renviron' file. And this '.Renviron' file will be created in your home directory. If this doesn't work, restart your R or R studio. The reason is the temporary directory was created before the current R session. So you have to restart another R session to implement this new TEMP_PATH configuration.