bcss home |
Customizing temp and library directories |
On Windows, it helps to use customized folders for temporary files
and for packages, instead of the usual defaults. This avoids a
couple of problems we have encountered, but is generally a good
idea.Windows defaults
On recent versions of Windows, the path to the
user’s Documents directory is typically The issues
We have had
issues with certain R functions where After installing R, you can check this by running
If "\\\\" or "//" or non-Western characters or unicode hex values (eg, <U+611B>) appear in the output, some R functions will fail. Other advantagesEven if the defaults work for you, R will sometimes 'lose' its temporary files. I think this is because the OS cleans up temporary files periodically. It also makes the temporary directory easy to find if you have to clean up manually after R crashes. It helps that the temp file is not buried deep in hidden folders and the library files are not cluttering up the Documents folder. Customizing foldersThis involves creating directories on the C: drive and then pointing R to use them. Create a new folder on the C: drive, call it "R", then do sub-directories named R_temp and R_libs, so you have "C:\R\R_temp" and "C:\R\R_libs". (You can use different names, but keep them short and without spaces or symbols.)
You may be able to use the .Renviron or .Rprofile files to point R
to these at start up, provided there is no problem with the path to
Documents. See Go to Control Panel > System > Advanced system settings > Environment variables -or- go to Settings and search for "environment variable". Create a new User environment variable named TMPDIR with value C:\R\R_temp. You should already have TEMP and TMP variables: do not change those. R looks first for TMPDIR; if not found, it uses TEMP or TMP. I think it's the only software to use TMPDIR, so setting this won't affect other programs. For the package libraries, create another environment variable with the name R_LIBS_USER and value C:\R\R_libs\%v.
The next time you run FeedbackIf you have suggestions, comments or questions about installing the software needed for the workshop please email stats.bcss@gmail.com. |
|
Page updated 11 Oct 2020 by Mike Meredith |