[R] Why does R start in wrong working directory despite R_USER setting?

Jeff Newmiller jdnewmil at dcn.davis.CA.us
Fri Aug 7 20:02:03 CEST 2015


Not really a question about R, but you can make a Windows shortcut that sets the directory where you want it.

My preference is to start in different working directories depending on which project I am working on. R_USER is not a project directory. One way to do that is to double-click on an RData file located where you want to start. Another way is to create a new shortcut in each directory. Another way is to add a line to your script that sets the directory appropriately, though that makes sharing the scripts harder. Another way is to use RStudio projects.
---------------------------------------------------------------------------
Jeff Newmiller                        The     .....       .....  Go Live...
DCN:<jdnewmil at dcn.davis.ca.us>        Basics: ##.#.       ##.#.  Live Go...
                                      Live:   OO#.. Dead: OO#..  Playing
Research Engineer (Solar/Batteries            O.O#.       #.O#.  with
/Software/Embedded Controllers)               .OO#.       .OO#.  rocks...1k
--------------------------------------------------------------------------- 
Sent from my phone. Please excuse my brevity.

On August 7, 2015 12:31:16 PM EDT, Mauricio Cornejo via R-help <r-help at r-project.org> wrote:
>Hi
>After launching newly-installed R 3.2.1 (on Windows 7), I run the
>following two commands:
>> getwd()[1] "C:/ProgramData/Microsoft/Windows/Start Menu/Programs/R"
>> Sys.getenv('R_USER')[1] "C:\\Users\\<my username>\\Documents"
>I would like the startup working directory to be that pointed to by
>R_USER.
>I don't have administrative access to the machine.
>Many thanks for any insight anyone can provide.
>Mauricio
>	[[alternative HTML version deleted]]
>
>______________________________________________
>R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
>https://stat.ethz.ch/mailman/listinfo/r-help
>PLEASE do read the posting guide
>http://www.R-project.org/posting-guide.html
>and provide commented, minimal, self-contained, reproducible code.



More information about the R-help mailing list