[R] Setting up a .Rprofile file
henrik.bengtsson at gmail.com
Fri Mar 24 18:25:28 CET 2017
R for Windows is a bit peculiar where it locates your .Rprofile file,
or rather what it consider to be your home directory. If you look
from within R, the file you do want to create / edit is:
> f <- normalizePath("~/.Rprofile", mustWork = FALSE)
For instance, to change what your R prompt looks you can add this from
within R as:
> cat('options(prompt = "> R ")\n', file = f, append = TRUE)
Hope this helps
On Fri, Mar 24, 2017 at 2:36 AM, Bruce Ratner PhD <br at dmstat1.com> wrote:
> 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 Ratner PhD
> The Significant Statistician™
> (516) 791-3544
> Statistical Predictive Analytics -- www.DMSTAT1.com
> Machine-Learning Data Mining -- www.GenIQ.net
>> On Mar 24, 2017, at 3:48 AM, Enrico Schumann <es at 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
>>> options (prompt "> R ")
>>> Can you help providing the code or instructive link,
>>> I've find many links, but I can't figure it out?
>> 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
> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
More information about the R-help