Learn R Programming

rite (version 0.3.4)

ritesink: ritesink

Description

An experimental tcl/tk output widget

Usage

sinkstart(echo = TRUE, split = FALSE, 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.
split
A logical indicating whether output (but not messages) should be split between the console and the sink. Default is 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.

Value

Shortcut keys in widget

: Copy : Cut : Paste : Select all : Save output : Clear output

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.

References

Top-level Task Callbacks in R

R2HTML package

Examples

Run this code
## Not run: 
# sinkstart() # open the sink
# sinkstop() # close the sink
# ## End(Not run)

Run the code above in your browser using DataLab