Skip to content
Prev 353474 / 398502 Next

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 <jdnewmil at dcn.davis.ca.us> wrote: