Henrik Bengtsson
2016-Nov-18 10:08 UTC
[Rd] Tell whether ./.Rprofile or ~/.Rprofile is being processed?
Hi.
Assume I have one ~/.Rprofile (in my home directory) and one
./.Rprofile (in my current working directory). In this case, the
latter will have higher priority and will be the script that R uses
during the startup process.
Is there a *generic* way to programmatically from within ./.Rprofile
and ~/.Rprofile to tell what their absolute pathnames are or
equivalently what directories they are located in? Conceptually
something like:
path <- directoryOfRprofile()
message("Running ", file.path(path, ".Rprofile"))
message(".Rprofile is in the home directory: ", normalizePath(path)
== normalizePath("~"))
I don't want to / cannot manually set the `path` variable.
Since .Rprofile is sourced very early on when R starts up (e.g.
sys.calls() is NULL), I suspect the answer to my question is no, but
maybe someone else can prove me wrong.
Thanks,
Henrik
Reasonably Related Threads
- Unable to compile with R CMD INSTALL on windows when sourcing from Rprofile
- Rprofile.site assignments occur in base package (PR#2448)
- .First and .Rprofile won't run on startup
- .Rprofile is being executed twice
- R devel [and R 2.14.1 patched]: R CMD build now sources ~/.Rprofile
