On 10/30/2009 10:35 PM, Huidong TIAN wrote:
Dear friends,

I will be very happy if anyone tell me the way to change work directory
permanently?
I mean not use the function setwd() which can only change temporary, when
you close the console, it will the old directory.
Sys.setenv(R_USER = '') also doesn't work.

Hi Huidong,
There are a few ways. One is to define a .First function in the directory where R starts and include the setwd() command in that:

.First<-function() {
 setwd("/home/huidong/R")
}

If you start up a new R session, create the .First function and then answer "y" to:

Save workspace image? [y/n/c]:

this function will be run when you start up R. You can add other commands to customize the R session, but remember to do so in a fresh session, then quit saving the workspace image each time you change .First.

Jim

______________________________________________
R-help@r-project.org 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.

Reply via email to