Hi,
Thanks for the quick response. You're correct that a lot of my issues can be resolved by maintaining a cleaner workspace, no doubt. At the moment, the same directory that holds the source files also holds lots of output from scripts that code in the source line generates, for example, so having a list of only the files that I decide to be part of a project is what I was looking for (and then also have RStudio tag only these files --- not sure if tagging is the official word, that's how it called in other editor that I'm using). Think about this as in git, where you have files that are part of the repository, and many that the repository know nothing about, and an .ignore list, which is basically mostly use to avoid clutter when you have git list the files, and when you use GUI on top of git. Most GUI interfaces for git, e.g. SourceTree, allows you to see only the files that git recognizes as part of the repository. So in a sense I guess that this is what I was missing, to define a project with an existing files but to manually choose which files are in that project. That's usually the behavior in various code editor that I worked with, e.g. SlickEdit, Netbeans, etc. -- you have to manually choose which files are part of the project, so I was a bit surprised by the all files are part of the project approach, but every editor is different.
In my case I have a bigger problem that probably has to do more with how my projects are structured in directories, which is probably (most definitely) not the way they should be. Maybe you can give me some guidance here, from the perspective of what will work best with RStudio? I will highly appreciate it if you do.
I have a bunch of projects that are related to Finance work. Some that takes care of my Portfolio, another that does some market analysis, another to implement algotrading, etc. As you may guess, that's a lot of basic code that is used by all projects, so I am sourcing many common files in all projects. What I have right now is definitely not how things are usually done: I have a parent directory Finance which is a project itself, and was the only project for many years, so has a lot of code that is used by the other projects. I then started adding subdirectories for each additional project, and rooted a RStudio projects in each. All common files are part of the first project, lying in the root, Finance directory. I know, messy, and not the way I will usually maintain real projects, but it help me avoid some issues with alternative approaches, as I mention below.
One other approach would be to have a parent Finance directory that is not a RStudio project, but includes all common files; then projects will be in subdirectories of it, and have a softlink from them to the common files in the parent directory. I assume here that RStudio follow soft links, so it will find function definitions even if the file is not physically in the project directory. There is an issue with this approach, though, with git: I could have a git repo per project, which makes sense but who is responsible for these common files? Should they be in a repo by themselves? I don't think that git allows having a repo that is rooted at a subdirectory of another repo, and it seems like a bad idea for me even if it does. I guess that another option would be to have the common file in a separate, non parent directory and manage them by a separate git repo. That may work.
What I have either now is a single git repo positioned at Finance (the parent directory), where all the common files sit, and branches for each project that resides in a subdirectory --- subprojects if you wish. That means merging to the trunk and then then to each of the branches updates to the common files, but these do not happen very often. All of that work but having an RStudio project at the top level, Finance, in order to be able to see the common file, is quite messy as it now shows me all the files of all other projects.
I think that the bottom line is that I was surprised by not being able to choose which files are part of my project, but the main reason that it bothers me is a poor structure of my different highly related projects. If you have any advice on that, I'll appreciate if you share it; otherwise I'll make some attempts and see how they work and look with RStudio.
Thanks much.