This should be working if you put a different .Rprofile in the
root directory of each project. I just tested it and got it working
fine. For example if you start a new project in
~/Desktop/foo then you run the following code:
This will open a new document called .Rprofile and I just put
the following commands in to test (note the blank line at the
1) print("Inside the foo project")
After that, you can switch projects from inside RStudio and it
will load the correct .Rprofile. Let me know if you are able to get
this working. Just make sure to save it in the root directory of
the project (where the foo.Rproj file is as well.).
I have a .Rprofile in the project directory, but it doesn't seem to be
loading from it. Do I need to create it with the commands you list below,
or should it recognize any file called .Rprofile in the working directory
for the project?
You don't need to use this exact command (it just opens up the
file if it exists or creates a new one). Are you naming the file
such as foo.Rprofile or is it just called
.Rprofile? This would lead to it loading the default
.Rprofile if you named it.
Well, I'm not sure why but when I created the .Rprofile using the step
file.edit() command you gave me, it now works. File looks exactly the same
as far as I can tell, but I must have done something wrong with it. Thanks
for your help.
If you were using notepad or another application it might have
saved it as a different file type (text file or something else). In
this case it could have added a hidden extension. Either way, glad
that you got this working.