Setting tilde (~) for a project (or some other way of dealing with paths)
Hello,
I'm trying to figure out the best way to consistently deal with paths in my projects. It would be nice if the tilde path (~) was customizable on a per-project basis. As it stands now, ~ expands to my C:\Users\username\Documents\ directory. I think I can customize ~ via .Renviron, but I'd like to do it on a per-project basis, not for all my R projects.
Does R-Studio provide facilities for that? If not, how do you suggest managing paths? I have lots of different script files that are all calling each other and setting working directories - it's become quite a mess. I've written pushd() and popd() functions that help, but it would still be useful to be able to use tilde.
thanks!
Comments are currently closed for this discussion. You can start a new one.
Support Staff 2 Posted by Josh Paulson on 12 Aug, 2012 09:22 PM
Allie,
We don't provide any tools or assistance in overriding "~" which points to your home directory. I'm actually not sure how to even change this, but as you've noted the default is my documents on Windows.
Also I'm not sure what the best way to manage this is, however for each project, you should have a root directory. For example:
Project 1: C:\user\projects\foo1
Project 2: C:\user\projects\foo2
When you open each of these projects (using RStudio's project features), it will source any .Rprofile or .Renviron that you have in that root directory. This way you can define code to run at the startup of any particular project (see
?Startupfor more information). Also the current working directory will be set to that root path.Hope this helps at least a little and good luck.
Josh
Josh Paulson closed this discussion on 19 Aug, 2012 12:34 PM.