#----------------------------
### 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")
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 switching on and off hints and details of start-up messages
#----------------------------
buildStartupMessage(pkg = "stats", msg)
options("StartupBanner" = "off")
buildStartupMessage(pkg = "stats", msg)
options("StartupBanner" = "complete")
buildStartupMessage(pkg = "stats", msg)
options("StartupBanner"="something else")
buildStartupMessage(pkg="stats", msg)
options("StartupBanner" = NULL)
buildStartupMessage(pkg = "stats", msg)
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)
Run the code above in your browser using DataLab