anna_l wrote:
Hello, I am using setwd() to change the working directory but I have to enter
it everytime I open R, is there a way to set this permanently as a working
directory? Thanx =^D
Hi Anna,
I create a .First function that is run when the session starts that looks like
this:
.First<-function () {
options(editor="nedit",show.signif.stars=FALSE)
source("SelectAnalysis.R")
}
This runs the file "SelectAnalysis.R" that looks like this:
cat("(B)ullying\n(P)alatability\nR\n")
answer<-toupper(readline("Enter the letter corresponding to the project - "))
if(answer == "B") setwd("/home/jim/research/bullying/R")
if(answer == "P") setwd("/home/jim/research/palatability_heavydrink/R")
if(answer == "R") setwd("/home/jim/R")
print(list.files(pattern="[.]R"))
I can then select whatever analysis I happen to be working on with a single letter (and newline)
and see all of the ".R" and ".Rdata" files in that directory.
Jim
______________________________________________
[email protected] mailing list
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.