Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

sinkplot

Send textual R output to a graphics device


Description

Divert R's standard text output to a graphics device.

Usage

sinkplot(operation = c("start", "plot", "cancel"), ...)

Arguments

operation

See below

...

Plot arguments. (Ignored unless operation="plot").

Details

This function allows the printed output of R commands to be captured and displayed on a graphics device.

The capture process is started by calling sinkplot("start"). Now R commands can be executed and all printed output (except errors) will be captured. When the desired text has been captured sinkplot("plot") can be called to actually display the output. sinkplot("cancel") can be used to abort the output capture without plotting.

The current implementation does not allow sinkplot to be nested.

Value

Invisibly returns a character vector containing one element for each line of the captured output.

Author(s)

Gregory R. Warnes greg@warnes.net

References

Functionality requested by Kevin Wright kwright@eskimo.com in the R-devel newlist posting https://stat.ethz.ch/pipermail/r-devel/2004-January/028483.html.

See Also

Examples

set.seed(12456)
   x <- factor(sample( LETTERS[1:5], 50, replace=TRUE))
   y <- rnorm(50, mean=as.numeric(x), sd=1)

   ## construct a figure showing a box plot of the data, followed by an
   ## analysis of variance table for the data
   layout(cbind(1:2), heights=c(2,1))

   boxplot(y~x, col="darkgreen")

   sinkplot()
   anova(lm(y~x))
   sinkplot("plot",col="darkgreen")

gplots

Various R Programming Tools for Plotting Data

v3.1.1
GPL-2
Authors
Gregory R. Warnes [aut], Ben Bolker [aut], Lodewijk Bonebakker [aut], Robert Gentleman [aut], Wolfgang Huber [aut], Andy Liaw [aut], Thomas Lumley [aut], Martin Maechler [aut], Arni Magnusson [aut], Steffen Moeller [aut], Marc Schwartz [aut], Bill Venables [aut], Tal Galili [ctb, cre]
Initial release
2020-11-28

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.