[Distr-commits] r1484 - in branches/distr-2.9/pkg/startupmsg: . R inst man tests/Examples

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Sat Jan 11 21:24:21 CET 2025


Author: ruckdeschel
Date: 2025-01-11 21:24:21 +0100 (Sat, 11 Jan 2025)
New Revision: 1484

Modified:
   branches/distr-2.9/pkg/startupmsg/DESCRIPTION
   branches/distr-2.9/pkg/startupmsg/NAMESPACE
   branches/distr-2.9/pkg/startupmsg/R/00.r
   branches/distr-2.9/pkg/startupmsg/R/illustration.R
   branches/distr-2.9/pkg/startupmsg/R/startUpMessage.R
   branches/distr-2.9/pkg/startupmsg/inst/NEWS
   branches/distr-2.9/pkg/startupmsg/man/myStartupUtilities.Rd
   branches/distr-2.9/pkg/startupmsg/tests/Examples/startupmsg-Ex.Rout.save
Log:
[startupmsg] ported changes for version 1.0.0 from trunk to branch 2.9

Modified: branches/distr-2.9/pkg/startupmsg/DESCRIPTION
===================================================================
--- branches/distr-2.9/pkg/startupmsg/DESCRIPTION	2025-01-11 20:22:57 UTC (rev 1483)
+++ branches/distr-2.9/pkg/startupmsg/DESCRIPTION	2025-01-11 20:24:21 UTC (rev 1484)
@@ -1,6 +1,6 @@
 Package: startupmsg
 Encoding: UTF-8
-Version: 0.9.8
+Version: 1.0.1
 Date: 2019-03-13
 Title: Utilities for Start-Up Messages
 Description: Provides utilities to create or suppress start-up messages.

Modified: branches/distr-2.9/pkg/startupmsg/NAMESPACE
===================================================================
--- branches/distr-2.9/pkg/startupmsg/NAMESPACE	2025-01-11 20:22:57 UTC (rev 1483)
+++ branches/distr-2.9/pkg/startupmsg/NAMESPACE	2025-01-11 20:24:21 UTC (rev 1484)
@@ -1,3 +1,4 @@
+importFrom("utils", "packageDescription")
 export("readVersionInformation", "readURLInformation",
        "pointertoNEWS", "infoShow", "NEWS", "TOBEDONE",
        "StartupMessage", "startupPackage", "startupType", 

Modified: branches/distr-2.9/pkg/startupmsg/R/00.r
===================================================================
--- branches/distr-2.9/pkg/startupmsg/R/00.r	2025-01-11 20:22:57 UTC (rev 1483)
+++ branches/distr-2.9/pkg/startupmsg/R/00.r	2025-01-11 20:24:21 UTC (rev 1484)
@@ -1,5 +1,6 @@
 # .onLoad<-function(lib,pkg){require(methods)}
 
+.onLoad<-function(lib,pkg) {options("StartupBanner" = "no-version", "StartupShowHint_sessionInfo" = TRUE)}
 .onAttach <- function(library, pkg)
 {
 #  if (is.null(library)) 

Modified: branches/distr-2.9/pkg/startupmsg/R/illustration.R
===================================================================
--- branches/distr-2.9/pkg/startupmsg/R/illustration.R	2025-01-11 20:22:57 UTC (rev 1483)
+++ branches/distr-2.9/pkg/startupmsg/R/illustration.R	2025-01-11 20:24:21 UTC (rev 1484)
@@ -34,16 +34,53 @@
  invisible(NULL) 
 }
 
-buildStartupMessage <- function(..., pkg, library=NULL, domain=NULL,
-                                packageHelp=FALSE, MANUAL = NULL, 
+buildStartupMessage <- function(..., pkg, library = NULL, domain = NULL,
+                                packageHelp = FALSE, MANUAL = NULL, 
                                 VIGNETTE = NULL,
-                                SMHandler=mySMHandler){
+                                SMHandler = mySMHandler){
 #
-tit.vers <- readVersionInformation(pkg,library)
-if((!getOption("StartupBanner")=="off")||is.null(getOption("StartupBanner"))) 
-       mystartupMessage(tit.vers$"title", " (version ", tit.vers$"ver", ")", 
+tit.vers <- readVersionInformation(pkg, library)
+if((!getOption("StartupBanner") == "off") || is.null(getOption("StartupBanner"))){
+    
+	versionHint0 <- gettext(
+	   'Detailed information about which packages are currently loaded ',
+       'or attached at which version (regardless of whether these have ',
+	   'start-up messages managed by this package) can be obtained by ',
+	   '"sessionInfo()".\n', 
+	   domain = domain)
+	versionHint <- ""
+	if(!is.null(getOption("StartupShowHint_sessionInfo")))   
+	   if(getOption("StartupShowHint_sessionInfo") ) versionHint <- versionHint0
+	
+	if(is.null(getOption("StartupBanner")) || 
+	   !getOption("StartupBanner") %in% c( "no-version", "no - version")){
+       mystartupMessage(tit.vers$"title", " (version ", tit.vers$"ver", ")\n",
+                        versionHint,  	   
                         domain = domain, pkg = pkg, type="version", 
                         SMHandler = SMHandler)
+	}else{
+       versInfoText <- ""
+	   if( getOption("StartupBanner")== "no-version" ){
+	       ## if no-version show this once but no more often:
+		   options("StartupBanner" = "no - version")
+	       versInfoText <- gettext(
+		      "Version information in start-up messages is currently suppressed. ", 
+	          'To see such information on startup as in versions of this pkg ',
+			  'prior to this versionr, set option "StartupBanner" to a value ', 
+			  'different to {"off", "no-version", "no - version"}, e.g., by ',
+              'options("StartupBanner" = "complete") or by ', 
+			  'options("StartupBanner" = NULL) or by ',
+	          'options("StartupBanner" = "something else").\n',
+			   domain = domain)
+	   }	   
+	   mystartupMessage("*** ",tit.vers$"title", " ***\n\n", versInfoText, 
+	     versionHint,  	                          
+		 domain = domain, pkg = pkg, type="information", 
+                        SMHandler = SMHandler)        		
+	}
+    options("StartupShowHint_sessionInfo" = FALSE)
+}	 
+
 ###
 if((getOption("StartupBanner")=="complete")||
     is.null(getOption("StartupBanner"))){ 
@@ -98,8 +135,8 @@
      #
      if (L>0){
           if (llist > 0)
-          mystartupMessage(..., domain=domain, pkg=pkg, type="notabene", 
-                          SMHandler=SMHandler)
+          mystartupMessage(..., domain = domain, pkg = pkg, type = "notabene", 
+                          SMHandler = SMHandler)
 
           mystartupMessage("For more information see ", 
                          packageHelpS, seps[1], NEWSS, seps[2], URLS, seps[3], 
@@ -109,8 +146,8 @@
     }
     else{
           if (llist > 0)
-          mystartupMessage(..., domain=domain, pkg=pkg, type="notabene", 
-                          SMHandler=SMHandler, endline = TRUE)
+          mystartupMessage(..., domain = domain, pkg = pkg, type = "notabene", 
+                          SMHandler = SMHandler, endline = TRUE)
     } 
    }
 }

Modified: branches/distr-2.9/pkg/startupmsg/R/startUpMessage.R
===================================================================
--- branches/distr-2.9/pkg/startupmsg/R/startUpMessage.R	2025-01-11 20:22:57 UTC (rev 1483)
+++ branches/distr-2.9/pkg/startupmsg/R/startUpMessage.R	2025-01-11 20:24:21 UTC (rev 1484)
@@ -57,11 +57,10 @@
 ###############################################################
 
 readVersionInformation <- function(pkg, library=NULL){      
-# next lines are taken from Valentin Todorov's package "rrcov"
-    if(is.null(library)) library <- .Library
-    ver <- read.dcf(file.path(library, pkg, "DESCRIPTION"), "Version")
-    ver <- as.character(ver)
-    title <- read.dcf(file.path(library, pkg, "DESCRIPTION"), "Title")
+    ## 20241113: use utils::packageDescription
+    ver <- utils::packageDescription(pkg, lib.loc = library, fields = "Version")
+	ver <- as.character(ver)
+    title <- utils::packageDescription(pkg, lib.loc = library, fields = "Title")
     title <- as.character(title)
 #
     list(ver=ver, title=title)
@@ -68,9 +67,8 @@
 }
 
 readURLInformation <- function(pkg, library=NULL){      
-# next lines are taken from Valentin Todorov's package "rrcov"
-    if(is.null(library)) library <- .Library
-    URL <- read.dcf(file.path(library, pkg, "DESCRIPTION"), "URL")
+    ## 20241113: use utils::packageDescription
+    URL <- utils::packageDescription(pkg, lib.loc = library, fields = "URL")
     if(is.na(URL)||(is.character(URL)&&length(URL)==0)) return(NULL)
     else return(as.character(URL))
 }

Modified: branches/distr-2.9/pkg/startupmsg/inst/NEWS
===================================================================
--- branches/distr-2.9/pkg/startupmsg/inst/NEWS	2025-01-11 20:22:57 UTC (rev 1483)
+++ branches/distr-2.9/pkg/startupmsg/inst/NEWS	2025-01-11 20:24:21 UTC (rev 1484)
@@ -3,10 +3,35 @@
 ######################################################################
 
 ##############
-v 0.9.7
+v 1.0.0
 ##############
 
 under the hood:
+We instantiated a more refined mechanism for startup messages, to avoid 
+unnecessary pkg version updates just triggered by startup messages issuing
+version information of attached packages upstream, which changes the
+reference output of the attaching package and hence creates diffs when
+tested on CRAN.
+
+Somewhat more detailed, in the prior regime, suppose we had pkgs pkgA and pkgB on 
+CRAN, pkgB importing the NAMESPACE of pkgA via depends, and both pkgs pkgA and pkgB 
+had startup messages including version information, and pkgB used the reference 
+output <pkgB>-Ex.Rout.save as a unit test for pkgB. Then, whenever we submitted an 
+updated version of pkgA to CRAN, we had to also submit a new version of pkgB to CRAN 
+regardless whether we had changed anything in pkgB, because of the changed version 
+information in the startup message of pkgA which showed up in the reference output 
+when pkgA was attached at loading pkgB.
+
+To avoid this, by default our startup messages no longer issue version information
+of the attached packages, but --only once per session-- we show a startup message
+indicating how to show the prior behaviour, i.e., show the version information
+of attached packages in the startup messages.
+
+##############
+v 0.9.7 (not submitted to CRAN)
+##############
+
+under the hood:
 with the help of K. Hornik identified spurious, platform dependent LF/CR issue
 and capsulated calls to infoShow() in Rd files by 
 ## IGNORE_RDIFF_BEGIN

Modified: branches/distr-2.9/pkg/startupmsg/man/myStartupUtilities.Rd
===================================================================
--- branches/distr-2.9/pkg/startupmsg/man/myStartupUtilities.Rd	2025-01-11 20:22:57 UTC (rev 1483)
+++ branches/distr-2.9/pkg/startupmsg/man/myStartupUtilities.Rd	2025-01-11 20:24:21 UTC (rev 1484)
@@ -72,53 +72,93 @@
 Either by \code{suppressStartupMessages(expr)} and \code{onlyversionStartupMessages(expr, atypes="version")}
 as for \code{startupmessage} (confer \code{\link{startupmsg}}), or -- as proposed by Brian Ripley -- by \code{options};
 let us describe the latter possibility here: 
-\itemize{\item \code{options("StartupBanner"="off")} switches off all start-up messages%
+\itemize{\item \code{options("StartupBanner" = "off")} switches off all start-up messages%
           \item if option \code{"StartupBanner"} is not defined (default) or setting    
-                    \code{options("StartupBanner"=NULL)} or  \code{options("StartupBanner"="complete")} 
+                    \code{options("StartupBanner" = NULL)} or  \code{options("StartupBanner" = "complete")} 
                     the complete start-up banner is displayed 
-          \item for any other value of option \code{"StartupBanner"} (i.e., not in \code{c(NULL,"off","complete")})
+          \item for any other value of option \code{"StartupBanner"} (i.e., not in \code{c(NULL, "off", "complete")})
                     only the version information is displayed 
-                    }%
+          \item from pkg version 1.0.0 on, the default of this option value is "no-version" (respectively "no - version"),
+                which suppresses version information to avoid unnecessary cascade of pkg submissions to CRAN triggered
+                by startup messages showing changed version information of attached/loaded packages up-stream.				
+			    }%
+Also, from version 1.0.0 on, we show a hint on how to obtain version information of all attached packages,
+regardless of whether these use start-up messages managed by this packages; i.e.; through sessionInfo().
+This hint is only shown once per session, but can also be switched on and off through 
+\code{options("StartupShowHint_sessionInfo")} set to \code{TRUE} or \code{FALSE}, respectively.				
 }
 
 \author{Peter Ruckdeschel \email{peter.ruckdeschel at uni-oldenburg.de}}
 \examples{
+#----------------------------
+### save old option values
+( oldOptionStartupBanner <- getOption("StartupBanner") )
+( oldOptionStartupShowHint_sessionInfo <- getOption("StartupShowHint_sessionInfo") )
+###
+#----------------------------
+
+
 ## a set of test messages
 
+options("StartupBanner" = "complete")
 msg <- "Note that you may set global options by options() --- cf. ?\"options\"."
 
 ## issuing of messages controlled by options()
-buildStartupMessage(pkg="stats", msg) 
-suppressStartupMessages(buildStartupMessage(pkg="stats", msg) )
-suppressMessages(buildStartupMessage(pkg="stats", msg))
-onlytypeStartupMessages(buildStartupMessage(pkg="stats", msg),
-          atypes="version")
+buildStartupMessage(pkg = "stats", msg) 
+suppressStartupMessages(buildStartupMessage(pkg = "stats", msg) )
+suppressMessages(buildStartupMessage(pkg = "stats", msg))
+onlytypeStartupMessages(buildStartupMessage(pkg = "stats", msg),
+          atypes = "version")
 
-getOption("StartupBanner")
-buildStartupMessage(pkg="stats", msg)
+MNH <- "https://www.r-project.org/"
+buildStartupMessage(pkg = "stats", msg, packageHelp = TRUE, MANUAL = MNH)
+## not quite a manual, but to illustrate the principle:
+## "demo/nlm.R" as a "manual": to be system-independent the 
+## first call is to be preferred 
+buildStartupMessage(pkg="stats", msg, packageHelp = TRUE, MANUAL = c("demo", "nlm.R"))
+###  works, too, (i.e. is equivalent) under Linux and Windows (at least):
+buildStartupMessage(pkg = "stats", msg, packageHelp = TRUE, MANUAL = "demo/nlm.R")
+###
 
-options("StartupBanner"="off");getOption("StartupBanner")
-buildStartupMessage(pkg="stats", msg)
+#----------------------------
+### options switching on and off hints and details of start-up messages
+#----------------------------
 
-options("StartupBanner"="complete");getOption("StartupBanner")
-buildStartupMessage(pkg="stats", msg)
+buildStartupMessage(pkg = "stats", msg)
 
-options("StartupBanner"="something else");getOption("StartupBanner")
-buildStartupMessage(pkg="stats", msg)
+options("StartupBanner" = "off")
+buildStartupMessage(pkg = "stats", msg)
 
-options("StartupBanner"=NULL);getOption("StartupBanner")
+options("StartupBanner" = "complete")
+buildStartupMessage(pkg = "stats", msg)
+
+options("StartupBanner"="something else")
 buildStartupMessage(pkg="stats", msg)
 
+options("StartupBanner" = NULL)
+buildStartupMessage(pkg = "stats", msg)
 
-MNH <- "https://www.r-project.org/"
-buildStartupMessage(pkg="stats", msg, packageHelp=TRUE, MANUAL=MNH)
-## not quite a manual, but to illustrate the principle:
-## "demo/nlm.R" as a "manual": to be system-independent the 
-## first call is to be preferred 
-buildStartupMessage(pkg="stats", msg, packageHelp=TRUE, MANUAL=c("demo","nlm.R"))
-###  works, too, (i.e. is equivalent) under Linux and Windows (at least):
-buildStartupMessage(pkg="stats", msg, packageHelp=TRUE, MANUAL="demo/nlm.R")
+options("StartupBanner" = "no-version") ## default
+buildStartupMessage(pkg = "stats", msg)
 
+options("StartupBanner" = "no - version")
+options("StartupShowHint_sessionInfo" = FALSE)
+buildStartupMessage(pkg = "startupmsg", packageHelp = TRUE)
+
+options("StartupBanner" = "no - version")
+options("StartupShowHint_sessionInfo" = TRUE)
+buildStartupMessage(pkg = "startupmsg", packageHelp = TRUE)
+
+options("StartupBanner" = "no-version")
+buildStartupMessage(pkg = "startupmsg", packageHelp = TRUE)
+
+options("StartupBanner" = "complete")
+buildStartupMessage(pkg = "startupmsg", packageHelp = TRUE)
+
+## restore old values 
+options("StartupBanner" = oldOptionStartupBanner)
+options("StartupShowHint_sessionInfo" = oldOptionStartupShowHint_sessionInfo)
+rm(oldOptionStartupBanner, oldOptionStartupShowHint_sessionInfo)
 }
 
 \seealso{Mail "[Rd] Wishlist: 'quietly' argument for .onAttach() / .First.lib()  "

Modified: branches/distr-2.9/pkg/startupmsg/tests/Examples/startupmsg-Ex.Rout.save
===================================================================
--- branches/distr-2.9/pkg/startupmsg/tests/Examples/startupmsg-Ex.Rout.save	2025-01-11 20:22:57 UTC (rev 1483)
+++ branches/distr-2.9/pkg/startupmsg/tests/Examples/startupmsg-Ex.Rout.save	2025-01-11 20:24:21 UTC (rev 1484)
@@ -1,6 +1,6 @@
 
-R Under development (unstable) (2024-08-17 r87027 ucrt) -- "Unsuffered Consequences"
-Copyright (C) 2024 The R Foundation for Statistical Computing
+R Under development (unstable) (2025-01-10 r87562 ucrt) -- "Unsuffered Consequences"
+Copyright (C) 2025 The R Foundation for Statistical Computing
 Platform: x86_64-w64-mingw32/x64
 
 R is free software and comes with ABSOLUTELY NO WARRANTY.
@@ -22,11 +22,24 @@
 > options(warn = 1)
 > options(pager = "console")
 > library('startupmsg')
-:startupmsg>  Utilities for Start-Up Messages (version 0.9.7)
+:startupmsg>  *** Utilities for Start-Up Messages ***
 :startupmsg> 
-:startupmsg>  For more information see ?"startupmsg",
-:startupmsg>  NEWS("startupmsg")
-
+:startupmsg>  Version information in start-up messages is
+:startupmsg>  currently suppressed. To see such information on
+:startupmsg>  startup as in versions of this pkg prior to this
+:startupmsg>  versionr, set option "StartupBanner" to a value
+:startupmsg>  different to {"off", "no-version", "no -
+:startupmsg>  version"}, e.g., by options("StartupBanner" =
+:startupmsg>  "complete") or by options("StartupBanner" = NULL)
+:startupmsg>  or by options("StartupBanner" = "something else").
+:startupmsg> 
+:startupmsg>  Detailed information about which packages are
+:startupmsg>  currently loaded or attached at which version
+:startupmsg>  (regardless of whether these have start-up
+:startupmsg>  messages managed by this package) can be obtained
+:startupmsg>  by "sessionInfo()".
+:startupmsg> 
+:startupmsg> 
 > 
 > base::assign(".oldSearch", base::search(), pos = 'CheckExEnv')
 > base::assign(".old_wd", base::getwd(), pos = 'CheckExEnv')
@@ -115,10 +128,35 @@
 ######################################################################
 
 ##############
-v 0.9.7
+v 1.0.0
 ##############
 
 under the hood:
+We instantiated a more refined mechanism for startup messages, to avoid 
+unnecessary pkg version updates just triggered by startup messages issuing
+version information of attached packages upstream, which changes the
+reference output of the attaching package and hence creates diffs when
+tested on CRAN.
+
+Somewhat more detailed, in the prior regime, suppose we had pkgs pkgA and pkgB on 
+CRAN, pkgB importing the NAMESPACE of pkgA via depends, and both pkgs pkgA and pkgB 
+had startup messages including version information, and pkgB used the reference 
+output <pkgB>-Ex.Rout.save as a unit test for pkgB. Then, whenever we submitted an 
+updated version of pkgA to CRAN, we had to also submit a new version of pkgB to CRAN 
+regardless whether we had changed anything in pkgB, because of the changed version 
+information in the startup message of pkgA which showed up in the reference output 
+when pkgA was attached at loading pkgB.
+
+To avoid this, by default our startup messages no longer issue version information
+of the attached packages, but --only once per session-- we show a startup message
+indicating how to show the prior behaviour, i.e., show the version information
+of attached packages in the startup messages.
+
+##############
+v 0.9.7 (not submitted to CRAN)
+##############
+
+under the hood:
 with the help of K. Hornik identified spurious, platform dependent LF/CR issue
 and capsulated calls to infoShow() in Rd files by 
 ## IGNORE_RDIFF_BEGIN
@@ -271,94 +309,175 @@
 > 
 > ### ** Examples
 > 
+> #----------------------------
+> ### save old option values
+> ( oldOptionStartupBanner <- getOption("StartupBanner") )
+[1] "no - version"
+> ( oldOptionStartupShowHint_sessionInfo <- getOption("StartupShowHint_sessionInfo") )
+[1] FALSE
+> ###
+> #----------------------------
+> 
+> 
 > ## a set of test messages
 > 
+> options("StartupBanner" = "complete")
 > msg <- "Note that you may set global options by options() --- cf. ?\"options\"."
 > 
 > ## issuing of messages controlled by options()
-> buildStartupMessage(pkg="stats", msg) 
+> buildStartupMessage(pkg = "stats", msg) 
 :stats>  The R Stats Package (version 4.5.0)
 :stats> 
+:stats> 
 :stats>  Note that you may set global options by options() --- cf.
 :stats>  ?"options".
 
-> suppressStartupMessages(buildStartupMessage(pkg="stats", msg) )
-> suppressMessages(buildStartupMessage(pkg="stats", msg))
-> onlytypeStartupMessages(buildStartupMessage(pkg="stats", msg),
-+           atypes="version")
+> suppressStartupMessages(buildStartupMessage(pkg = "stats", msg) )
+> suppressMessages(buildStartupMessage(pkg = "stats", msg))
+> onlytypeStartupMessages(buildStartupMessage(pkg = "stats", msg),
++           atypes = "version")
 The R Stats Package (version 4.5.0)
 
+
 > 
-> getOption("StartupBanner")
-NULL
-> buildStartupMessage(pkg="stats", msg)
+> MNH <- "https://www.r-project.org/"
+> buildStartupMessage(pkg = "stats", msg, packageHelp = TRUE, MANUAL = MNH)
 :stats>  The R Stats Package (version 4.5.0)
 :stats> 
+:stats> 
 :stats>  Note that you may set global options by options() --- cf.
 :stats>  ?"options".
+:stats> 
+:stats>  For more information see ?"stats"
 
-> 
-> options("StartupBanner"="off");getOption("StartupBanner")
-[1] "off"
-> buildStartupMessage(pkg="stats", msg)
-> 
-> options("StartupBanner"="complete");getOption("StartupBanner")
-[1] "complete"
-> buildStartupMessage(pkg="stats", msg)
+> ## not quite a manual, but to illustrate the principle:
+> ## "demo/nlm.R" as a "manual": to be system-independent the 
+> ## first call is to be preferred 
+> buildStartupMessage(pkg="stats", msg, packageHelp = TRUE, MANUAL = c("demo", "nlm.R"))
 :stats>  The R Stats Package (version 4.5.0)
 :stats> 
+:stats> 
 :stats>  Note that you may set global options by options() --- cf.
 :stats>  ?"options".
+:stats> 
+:stats>  For more information see ?"stats", as well as
+:stats>    C:/PF/R/R-devel/library/stats/demo/nlm.R
 
-> 
-> options("StartupBanner"="something else");getOption("StartupBanner")
-[1] "something else"
-> buildStartupMessage(pkg="stats", msg)
+> ###  works, too, (i.e. is equivalent) under Linux and Windows (at least):
+> buildStartupMessage(pkg = "stats", msg, packageHelp = TRUE, MANUAL = "demo/nlm.R")
 :stats>  The R Stats Package (version 4.5.0)
 :stats> 
-> 
-> options("StartupBanner"=NULL);getOption("StartupBanner")
-NULL
-> buildStartupMessage(pkg="stats", msg)
-:stats>  The R Stats Package (version 4.5.0)
 :stats> 
 :stats>  Note that you may set global options by options() --- cf.
 :stats>  ?"options".
+:stats> 
+:stats>  For more information see ?"stats", as well as
+:stats>    C:/PF/R/R-devel/library/stats/demo/nlm.R
 
+> ###
 > 
+> #----------------------------
+> ### options switching on and off hints and details of start-up messages
+> #----------------------------
 > 
-> MNH <- "https://www.r-project.org/"
-> buildStartupMessage(pkg="stats", msg, packageHelp=TRUE, MANUAL=MNH)
+> buildStartupMessage(pkg = "stats", msg)
 :stats>  The R Stats Package (version 4.5.0)
 :stats> 
+:stats> 
 :stats>  Note that you may set global options by options() --- cf.
 :stats>  ?"options".
-:stats> 
-:stats>  For more information see ?"stats"
 
-> ## not quite a manual, but to illustrate the principle:
-> ## "demo/nlm.R" as a "manual": to be system-independent the 
-> ## first call is to be preferred 
-> buildStartupMessage(pkg="stats", msg, packageHelp=TRUE, MANUAL=c("demo","nlm.R"))
+> 
+> options("StartupBanner" = "off")
+> buildStartupMessage(pkg = "stats", msg)
+> 
+> options("StartupBanner" = "complete")
+> buildStartupMessage(pkg = "stats", msg)
 :stats>  The R Stats Package (version 4.5.0)
 :stats> 
+:stats> 
 :stats>  Note that you may set global options by options() --- cf.
 :stats>  ?"options".
-:stats> 
-:stats>  For more information see ?"stats", as well as
-:stats>    C:/PF/R/R-devel5/library/stats/demo/nlm.R
 
-> ###  works, too, (i.e. is equivalent) under Linux and Windows (at least):
-> buildStartupMessage(pkg="stats", msg, packageHelp=TRUE, MANUAL="demo/nlm.R")
+> 
+> options("StartupBanner"="something else")
+> buildStartupMessage(pkg="stats", msg)
 :stats>  The R Stats Package (version 4.5.0)
 :stats> 
+:stats> 
+> 
+> options("StartupBanner" = NULL)
+> buildStartupMessage(pkg = "stats", msg)
+:stats>  The R Stats Package (version 4.5.0)
+:stats> 
+:stats> 
 :stats>  Note that you may set global options by options() --- cf.
 :stats>  ?"options".
+
+> 
+> options("StartupBanner" = "no-version") ## default
+> buildStartupMessage(pkg = "stats", msg)
+:stats>  *** The R Stats Package ***
 :stats> 
-:stats>  For more information see ?"stats", as well as
-:stats>    C:/PF/R/R-devel5/library/stats/demo/nlm.R
+:stats>  Version information in start-up messages is currently
+:stats>  suppressed. To see such information on startup as in
+:stats>  versions of this pkg prior to this versionr, set option
+:stats>  "StartupBanner" to a value different to {"off",
+:stats>  "no-version", "no - version"}, e.g., by
+:stats>  options("StartupBanner" = "complete") or by
+:stats>  options("StartupBanner" = NULL) or by
+:stats>  options("StartupBanner" = "something else").
+:stats> 
+:stats> 
+> 
+> options("StartupBanner" = "no - version")
+> options("StartupShowHint_sessionInfo" = FALSE)
+> buildStartupMessage(pkg = "startupmsg", packageHelp = TRUE)
+:startupmsg>  *** Utilities for Start-Up Messages ***
+:startupmsg> 
+:startupmsg> 
+> 
+> options("StartupBanner" = "no - version")
+> options("StartupShowHint_sessionInfo" = TRUE)
+> buildStartupMessage(pkg = "startupmsg", packageHelp = TRUE)
+:startupmsg>  *** Utilities for Start-Up Messages ***
+:startupmsg> 
+:startupmsg>  Detailed information about which packages are
+:startupmsg>  currently loaded or attached at which version
+:startupmsg>  (regardless of whether these have start-up
+:startupmsg>  messages managed by this package) can be obtained
+:startupmsg>  by "sessionInfo()".
+:startupmsg> 
+:startupmsg> 
+> 
+> options("StartupBanner" = "no-version")
+> buildStartupMessage(pkg = "startupmsg", packageHelp = TRUE)
+:startupmsg>  *** Utilities for Start-Up Messages ***
+:startupmsg> 
+:startupmsg>  Version information in start-up messages is
+:startupmsg>  currently suppressed. To see such information on
+:startupmsg>  startup as in versions of this pkg prior to this
+:startupmsg>  versionr, set option "StartupBanner" to a value
+:startupmsg>  different to {"off", "no-version", "no -
+:startupmsg>  version"}, e.g., by options("StartupBanner" =
+:startupmsg>  "complete") or by options("StartupBanner" = NULL)
+:startupmsg>  or by options("StartupBanner" = "something else").
+:startupmsg> 
+:startupmsg> 
+> 
+> options("StartupBanner" = "complete")
+> buildStartupMessage(pkg = "startupmsg", packageHelp = TRUE)
+:startupmsg>  Utilities for Start-Up Messages (version 1.0.0)
+:startupmsg> 
+:startupmsg> 
+:startupmsg>  For more information see ?"startupmsg",
+:startupmsg>  NEWS("startupmsg")
 
 > 
+> ## restore old values 
+> options("StartupBanner" = oldOptionStartupBanner)
+> options("StartupShowHint_sessionInfo" = oldOptionStartupShowHint_sessionInfo)
+> rm(oldOptionStartupBanner, oldOptionStartupShowHint_sessionInfo)
 > 
 > 
 > 
@@ -367,7 +486,7 @@
 > cleanEx()
 > options(digits = 7L)
 > base::cat("Time elapsed: ", proc.time() - base::get("ptime", pos = 'CheckExEnv'),"\n")
-Time elapsed:  0.15 0.07 0.23 NA NA 
+Time elapsed:  0.09 0.03 0.14 NA NA 
 > grDevices::dev.off()
 null device 
           1 



More information about the Distr-commits mailing list