[R] R-help Digest, Vol 80, Issue 30
Jim Lemon
jim at bitwrit.com.au
Sun Nov 1 00:59:28 CET 2009
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
More information about the R-help
mailing list