Roger Peng
2003-Mar-05 02:53 UTC
[Rd] order of package loading and printing messages to console on startup
Recently in R-devel, I've noticed that when I start up R, code in .Rprofile (in the working directory) gets sourced but any messages printed out by that code (e.g. by `cat') are printed *before* the introductory statement about R. For example, if I put the line library(KernSmooth) in my .Rprofile file, I get artemis:> R KernSmooth 2.22 installed Copyright M. P. Wand 1997 R : Copyright 2003, The R Development Core Team Version 1.7.0 Under development (unstable) (2003-03-04) R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type `license()' or `licence()' for distribution details. [...]>I assume this is because of the order in which packages are loaded. I was wondering if this behavior is desired? I couldn't find anything in ?Startup. Obviously not a critical issue but it seems a bit odd. Of course, if I wrap everything with a call to .First() in my .Rprofile file, then the package gets loaded last and the corresponding messages are printed last. I'm using> version_ platform i686-pc-linux-gnu arch i686 os linux-gnu system i686, linux-gnu status Under development (unstable) major 1 minor 7.0 year 2003 month 03 day 04 language R -roger _______________________________ UCLA Department of Statistics rpeng@stat.ucla.edu http://www.stat.ucla.edu/~rpeng
ripley@stats.ox.ac.uk
2003-Mar-05 08:47 UTC
[Rd] order of package loading and printing messages to console on startup
What's changed is when the introductory message is printed, not when code in .Rprofile is run: revision 1.118 date: 2003/02/26 15:51:17; author: pd; state: Exp; lines: +6 -6 RNG change + delayed greeting So it was intentional, but Peter D will have to explain why (as I wasn't paying attention). The profiles are run quite early (before the default packages are loaded) and I think it is preferable to use .First to load packages (now the system no longer makes use of it for that purpose). On Tue, 4 Mar 2003, Roger Peng wrote:> Recently in R-devel, I've noticed that when I start up R, code in > .Rprofile (in the working directory) gets sourced but any messages printed > out by that code (e.g. by `cat') are printed *before* the introductory > statement about R.[...] -- Brian D. Ripley, ripley@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