On Fri, 24 Mar 2017, Bruce Ratner PhD writes: > Henrico: > Thanks for quick reply. > However, one last question: > If I want to change working directory, and put setwd() in the Rprofile > file, logically R will not know where the be work directory is, > correct? > > So, should I install R in my preferred working directory? > > Thanks again, in advance. > Bruce >
Hm, I think I don't understand what you mean here. Where R is installed and where it is run are (usually) not the same places. Let $ be a shell prompt, and let > be the R prompt. Then: $ cd /tmp/ $ R -q > getwd() [1] "/tmp" > q("no") $ cd ~/Documents/ $ R -q > getwd() [1] "~/Documents" Now I write into my "~./Rprofile" file: setwd("~/Downloads") $ cd /tmp/ $ R -q > getwd() [1] "~/Downloads" But maybe I am completely misunderstanding what you mean.... Kind regards Enrico > > >> On Mar 24, 2017, at 3:48 AM, Enrico Schumann <e...@enricoschumann.net> wrote: >> >> On Thu, 23 Mar 2017, Bruce Ratner PhD writes: >> >>> Hi R'ers: >>> I would like to setting up a .Rprofile file with >>> setwd("C:/R_WorkDir") >>> set.seed(12345) >>> options (prompt "> R ") >>> >>> --- >>> Can you help providing the code or instructive link, >>> I've find many links, but I can't figure it out? >>> >>> Thanks. >>> Bruce >>> >> >> Quoting from ?Startup: >> >> ,---- >> | [...] unless ‘--no-init-file’ was given, R searches >> | for a user profile, a file of R code. The path of >> | this file can be specified by the ‘R_PROFILE_USER’ >> | environment variable (and tilde expansion will be >> | performed). If this is unset, a file called >> | ‘.Rprofile’ is searched for in the current directory >> | or in the user's home directory (in that order). The >> | user profile file is sourced into the workspace. >> `---- >> -- Enrico Schumann Lucerne, Switzerland http://enricoschumann.net ______________________________________________ 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.