console_help: User updates and interaction via the console in default color...

View source: R/say.R

console_helpR Documentation

User updates and interaction via the console in default color and style

Description

User updates and interaction via the console in default color and style

Usage

console_help()

say(..., lev = 0, sub = 0, clear = FALSE)

cat0(..., clear = FALSE)

continue(clear = FALSE)

xcon()

Arguments

...

An arbitrary number of atomic arguments to be atomized collapsed into a character scalar message to the user. If no values are supplied and lev = NA or lev = 6, prints a single dot (.) immediately following the current contents of the console.

lev

Either NA to print the message in ... immediately following the current contents of the console or a value from 1:6 to use the console for up to 6 levels of user updates. See function say below.

sub

Either 0, 1, or 2. See function say below.

clear

Either TRUE or FALSE indicating whether to clear the console before printing a message to it.

Value

NULL.

Functions

  • say(): Flattens ... to a character scalar message and either (a) prints it to the console or (b) structures it as an update and prints it to the console. When ... is empty, the message defaults to a single dot ("."). Allows for structuring user update messages at hierarchical levels as explained in the following table:

      VALUE   PREFIX OF MESSAGE
      OF lev   POSTED TO CONSOLE
      0 < none >
      1 < newline >
      2 < newline > + '| '
      3 < newline > + '| > '
      4 < newline > + '| | > '
      5 < newline > + '| | | > '
      ... ...
  • cat0(): Flattens ... into a character scalar and prints it to the console preceded and succeeded by a new line.

  • continue(): Prints "Hit [enter] or [return] to continue" to the console and pause execution until the user hits the enter or return key.

  • xcon(): Clears the console.

See Also

Other meta: callers(), dot_args(), pause(), ply_help(), purge_help(), recycling_help(), run()

Other console: alert_utils()

Examples

xcon()
cat0("msg on its own line")
chat. <- function() {
  say("msg 1A", lev = 1)
  say("msg 2A", lev = 2)
  say("msg 2B", lev = 2)
  say("msg 3A", lev = 3)
  say("msg 3B", lev = 3)
  say()
  say()
  say()
  say("msg 3C", lev = 3)
  say("msg 4A", lev = 4)
  say("msg 4B", lev = 4)
  say("msg 5A", lev = 5)
  say(lev = 6)
  say(lev = 6)
  say("msg 5B", lev = 5)
  say("msg 3D", lev = 3)
  say()
  say()
  say("msg 1B", lev = 1)
  say(" + a_random_mssg")
}
chat.()
## Not run: continue()

j-martineau/uj documentation built on Sept. 14, 2024, 4:40 a.m.