How to avoid RStudio writing cache to SSD?

I have RStudio and R installed in my SSD with only 13 GB of empty space left. The problem is that when I launch some demanding algorithm with RStudio, it quickly fills my SSD with some temporary files that are quit huge, probable because of 16 GB RAM I have in my computer. However, I also have 1 TB almost empty hard disk in the same computer. Is it possible to reroute those temp files to hard disk? Any suggestions how to do this?

One solution I have tried was to specify alternative values for TMPDIR, TMP and TEMP variables in .Renviron file. However, it did not solved the problem.

what operating system are you using?

I think where R Studio puts temp files can be impacted by setting HOME or R_USER environment variables.

Thank you for the answer. OS is windows 10. I have tried to change HOME and R_USER variables as well, however, this doesn't help.

IIRC, these environment variables need to be set before R is launched, so setting them in an .Renviron is too late. You can try changing the default Windows environment environment variables for the system rather than setting them in .Renviron.