Location of .Renviron file?

Hi All,
I was hoping someone would be able to help clarify something for me. I am using a .Renviron file with the following code to add something onto the current path and to change the pointer of the library

PATH="${RTOOLS40_HOME}\usr\bin;${PATH}"
R_LIBS_SITE="C:\\Program Files\\R\\R-4.1.1\\library"

What I am a little confused at is where exactly to put the .Renviron file.
I have seen some people state that it should go in RHOME but I'm not 100% sure where exactly that is. I have also seen some posts state to put it in your current working directory.

I currently have mine located in C:\Program Files\R\R-4.1.1\library
And have previously had it in C:\Users\myusername\Documents\Rworkspace\Tutorials R Files

I have also just realised that I am storing the file in the directory I am telling the file to point too. So, It’s not a surprise that isn’t working. Would the correct place be in the directory above library ?

Renviron.site file for R-version level should be located at R_HOME/etc/, .Renviron file, for user-level should be located at your HOME folder and for project-level it should be located at the project's root folder.

Each one of these levels overwrites the previous one in case more than one file is found.

1 Like

Brillant, thank you for the quick response.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.