R Projects & related scripts



I'm sure I'm just not getting something basic. I'm using RStudio1.1.383 with
R 3.4.3 in Windows 10. When I have a project in RStudio, no matter what I do, the scripts associated with it are not loaded when I open the project, either by double clicking the .Rproj file in Windows Explorer, or by opening the project once in RStudio. What am I doing wrong?


RStudio projects save your state (not in the .Rproj file, but in the hidden .Rproj.user directory). So, if you had the files open when you last used the project, they should open again when you re-open the project. On the other hand, if the files were closed, you'll have to re-open the ones you want to use.

Are files not opening that you had open when you last closed out the project?


Hi--As you describe is my understanding. But what I'm experiencing is different, presumably due to my error. The image shows 4 screen shots from RStudio. The project is open at top left (1), the script is open, the environment has data. I used "Close Project" from the top right drop down resulting in (2). In (3) I used the top right dropdown to re-open the project. The script is not loaded. In (4) I show the options settings. Note that although not shown in (4), the correct directory is open in the Files pane and the script is there.


Under ToolsGlobal OptionsGeneral, do you have "Restore previously open source documents at startup" checked? I forgot that was an option in my previous response.


That was the problem. Thank you. I was focusing on project options to resolve this and overlooked checking the global options. Next time I'll look at everything before asking!

Thank you again. I am a huge fan of R, RStudio, and more recently R Notebooks.