[R] detecting the sourcing of site profile on Startup versus post-Startup

Benjamin Tyner btyner at gmail.com
Wed Apr 23 02:59:57 CEST 2014


Is there any way to programmatically detect whether a piece of code is
being run within the initial (Startup) sourcing of the site profile?

For example, say I have a site profile, "/path/to/Rprofile.site". Is
there any function "my_func" which would return different values for
these two instances:

   Rscript --no-site-profile --no-init-profile -e
"sys.source('/path/to/Rprofile.site', envir = .BaseNamespaceEnv); my_func()"


   export R_PROFILE=/path/to/Rprofile.site
   Rscript --no-init-profile -e "my_func()"


More information about the R-help mailing list