I was instructed to enter a TMPDIR in my .Renviron file. I did that, but RStudio still opens or creates temporary files that are detected by Dropbox when working on projects. Is there a way that I can have temporary project files also directed to a specific temporary directory that is NOT the project directory?
I forgot to include the directions by @kevinushey:
See the documentation in ?tempdir . In particular:
By default,
tmpdirwill be the directory given bytempdir(). This will be a subdirectory of the per-session temporary directory found by the following rule when the R session is started. The environment variables TMPDIR, TMP and TEMPare checked in turn and the first found which points to a writable directory is used: if none succeeds ‘/tmp’ is used. The path should not contain spaces. Note that setting any of these environment variables in the R session has no effect ontempdir(): the per-session temporary directory is created before the interpreter is started.
In other words, you likely need to set the TMPDIR environment variable, and need to set it in a project-specific way. You could accomplish this by setting this in a project-local .Renviron file; e.g.
TMPDIR = /path/to/tmpdir
See ?Startup for more details on how .Renviron works and how those files are read during startup.
I suppose what I am trying to ask is whether I can direct RStudio to direct all temporary, e.g. unsaved, work to a specific, especially non-project specific directory. I tried following Kevin's directions, but those temporary unsaved files are opened in my project directory, not the one assigned by TMPDIR.
Sorry for the late response.
I suspect you're referring to the files written to the .Rproj.user folder, where RStudio writes project-specific state. Unfortunately, there isn't currently a mechanism for relocating that folder elsewhere.