[Rd] delay of warning for things in .Rprofile

Prof Brian Ripley ripley at stats.ox.ac.uk
Wed Mar 9 07:33:14 CET 2005


On Tue, 8 Mar 2005, Liaw, Andy wrote:

> Hi all,
>
> I was playing with R-devel 2005-03-08 on winXP Pro (installed from Duncan's
> installer).  My .Rprofile contains:
>
> options(defaultPackages=c(getOption("defaultPackages"), "mypkg"),
>        chmhelp=TRUE)
>
> but "mypkg" has not yet been installed in the library/ directory of this
> installation.  When Rgui starts, I do not get any error or warning, but upon
> running one command, I get:
>
> Warning messages:
> 1: there is no package called 'mypkg' in: library(package, character.only =
> TRUE, logical = TRUE, warn.conflicts = warn.conflicts,
> 2: package mypkg in options("defaultPackages") was not found
>
> This seems a bit strange...  I would expect the warning to show up before
> the first prompt.  Is this intentional?

It is normal.  By default (options(warn=0)), warnings are collected and
(to quote the help page) `printed after the top-level function has 
completed'.  Warnings during startup wait until a top-level command has 
been completed.  It is done in the main REPL loop at main.c:362 (and also 
under some error conditions).

As to whether this is intentional: I don't know but it would be helpful to 
change it, so I will.

Brian

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595



More information about the R-devel mailing list