Re: [R] Why does R start in wrong working directory despite R_USER setting?
I would like the startup working directory to be that pointed to by R_USER. In Windows, right click on your R desktop shortcut (or create a new one pointing to Rgui.exe) and on the properties tab, change Start in: to %R_USER% R will then start 'in' the R_USER directory if R_USER exists (that is, the working directory will be set to R_USER's contents). S Ellison *** This email and any attachments are confidential. Any use...{{dropped:8}} __ R-help@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.
Re: [R] Why does R start in wrong working directory despite R_USER setting?
Hi Mauricio, You can also run a directory selection file by including something like this: source(SelectAnalysis.R) in the .First function (see An Introduction to R, section 10.8 Customizing the environment). Mine currently looks like this: cat((A)custudy\n(I)nterval analysis\n(O)mbo mapping\nR\n(C)ourse\nStressaly(Z)er\n) answer-toupper(readline(Choose the project - )) if(answer==A) setwd(/home/jim/research/im/acustudy) if(answer==I) setwd(/home/jim/research/interval_analysis) if(answer==O) setwd(/home/jim/research/ombo/mapping) if(answer==R) setwd(/home/jim/R) if(answer==C) setwd(/home/jim/bitwrit/R_programming_course) if(answer==Z) setwd(/home/jim/research/stressalyser/naomi) print(list.files(pattern=[.]R)) options(browser=konqueror,editor=kwrite,show.signif.stars=FALSE) This should work on any system, regardless of your privileges. Jim On Sat, Aug 8, 2015 at 4:02 AM, Jeff Newmiller jdnew...@dcn.davis.ca.us wrote: 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 NewmillerThe . . Go Live... DCN:jdnew...@dcn.davis.ca.usBasics: ##.#. ##.#. Live Go... Live: OO#.. Dead: OO#.. Playing Research Engineer (Solar/BatteriesO.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@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@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. __ R-help@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. __ R-help@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.
[R] Why does R start in wrong working directory despite R_USER setting?
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@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.
Re: [R] Why does R start in wrong working directory despite R_USER setting?
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 NewmillerThe . . Go Live... DCN:jdnew...@dcn.davis.ca.usBasics: ##.#. ##.#. Live Go... Live: OO#.. Dead: OO#.. Playing Research Engineer (Solar/BatteriesO.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@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@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. __ R-help@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.
Re: [R] Why does R start in wrong working directory despite R_USER setting?
Assuming you are using the GUI you can use the Properties of the shortcut to tell R where to start. On 07/08/2015 17:31, Mauricio Cornejo via R-help 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@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. -- Michael http://www.dewey.myzen.co.uk/home.html __ R-help@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.