sink: ritesink

Description Usage Arguments Details Value Shortcut keys in widget Author(s) References Examples

Description

An experimental tcl/tk output widget

Usage

1
2
3
4
5
6
7
sinkstart(echo = TRUE, print.eval = TRUE, split = FALSE,
  prompt.echo = getOption("prompt", "> "), fontFamily = "Courier",
  fontSize = 10, col.bg = "white", col.call = c("black", col.bg),
  col.result = c("black", col.bg), col.err = c("red", col.bg),
  col.warn = c("purple", col.bg), col.msg = c("blue", col.bg))

sinkstop(quiet = TRUE)

Arguments

echo

A logical indicating whether calls should be output to the sink. Default is TRUE.

print.eval

A logical indicating whether evaluated output from calls and/or messages should be sent to the sink. Default is TRUE.

split

A logical indicating whether output (but not messages) should be split between the console and the sink. Default is FALSE.

prompt.echo

A character string indicating the text to use for the prompt in the widget. The default is drawn from options("prompt"). Ignored if echo = FALSE.

fontFamily

The font family used in rite. Default is “Courier”. Available fonts can be retrieved by .Tcl("font families").

fontSize

The font size used in rite. Default is 10.

col.bg

A one-element character string indicating a tcl/tk color for the background color of the sink. A list of available tcl/tk colors can be found here: http://www.tcl.tk/man/tcl8.5/TkCmd/colors.htm.

col.call

A two-element character vector indicating tcl/tk colors for the foreground and background, respectively, of evaluated R calls (only visible if echo=TRUE..

col.result

A two-element character vector indicating tcl/tk colors for the foreground and background, respectively, of standard output.

col.err

A two-element character vector indicating tcl/tk colors for the foreground and background, respectively, of errors.

col.warn

A two-element character vector indicating tcl/tk colors for the foreground and background, respectively, of warnings.

col.msg

A two-element character vector indicating tcl/tk colors for the foreground and background, respectively, of messages.

quiet

A logical indicating whether to suppress confirmation that everything is cleaned up. Default is TRUE.

Details

These functions make use of a couple of different R features to build a color-coded output window for the R console. While the console is limited to displaying output in monochrome plain text, the rite sink allows multi-colored output and messages to be piped to a single widget that highlights errors, warning, and messages. Unlike a traditional sink, rite sink is a tcl/tk widget that updates output as commands and messages occur. Accomplishing this requires the use of sink, task callbacks, and a custom error handler. (This is similar to the R2HTML package.)

sinkstart starts the sink and sinkstop stops the sink without destroying the widget. Closing the sink widget invisibly calls sinkstop and cleans up. The sink can be turned on and off repeatedly without closing the widget.

Value

NULL

Shortcut keys in widget

<Ctrl-c>: Copy

<Ctrl-x>: Cut

<Ctrl-p>: Paste

<Ctrl-a>: Select all

<Ctrl-s>: Save output

<Ctrl-l>: Clear output

Author(s)

Thomas J. Leeper

References

Top-level Task Callbacks in R

R2HTML package

Examples

1
2
3
4
5
## Not run: 
sinkstart() # open the sink
sinkstop() # close the sink

## End(Not run)

leeper/rite documentation built on Aug. 1, 2018, 6:33 a.m.