[Rd] Detaching "ctest"

Kurt Hornik Kurt.Hornik@ci.tuwien.ac.at
Fri, 30 Mar 2001 12:03:02 +0200

>>>>> Jonathan Rougier writes:

> Hi Everyone,
> We have just upgraded to R-1.2.1, and I note, in contrast to R-1.1.1, that
> ctest is now loaded automatically.  The mechanism for this is to create a
> .First function in base:

> .First <- function() {
>     require("ctest", quietly=TRUE)
> }

> Now I don't want ctest, but I find that simply putting

> if (length(grep("ctest", search())))
>   detach(package:ctest)

> into my ".Rprofile" does not work, for the simple reason that .First is
> invoked after .Rprofile.  I thought that one possible solution is to
> remove .First from base, but when I tried this I got

>> find(".First")
> [1] "package:base"
>> search()
> [1] ".GlobalEnv"      "package:ctest"   "package:patches" "Autoloads"      
> [5] "package:base"   
>> remove(".First", pos=5)
> Warning message: 
> remove: variable ".First" was not found 
>> remove(".First", inherits=TRUE)
> Warning message: 
> remove: variable ".First" was not found

Which looks rather strange to me ... 

> Is it not possible to remove things from "base"?  The alternative is
> to mask the .First with a blank one in my .Rprofile, but this seems
> rather inelegant.

> So my questions are:

> (1) Why has ctest been included among the start-up options, and why has
> this mechanism of using the .First been used, rather than relying on
> people putting the command require("ctest", quietly=TRUE) into the
> .Rprofile?

> (2) Is there an elegant way of me stopping ctest from being loaded, other
> then editing the Rprofile in R-1.2.1/lib/R/library/base/R/?

There was a great amount of discussion on r-core whether or not ctest
should be preloaded.  We all agree that base is way too large, and that
it eventually should basically be a core S language interpreter, with
everything else available ``on demand''.  Re add-on packages, there are
two obvious possibilities:

* only provide base by default, and let users or site admins customize
  the list of packages they want by default.

* provide packages like ctest (and maybe ts) by default, and have site
  admins or users overrule the default settings.

In a Unix-centric world the former would be the obvious choice.
However, there was great concern about the situation on Windows, where
the intermediate ``site admin'' level typically would not be available,
and we do not want to have first time R windows users start complaining
about R as a stats package that cannot even do a t test.  Hence, we went
for the latter.

The ``elegant'' way we recommend is that either you as site admin
provide a site version of .First in $R_HOME/etc/Rprofile, or you as user
provide your private version of .First in $HOME/.Rprofile.

Hope this helps.

r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-devel-request@stat.math.ethz.ch