
Last chance! 50% off unlimited learning
Sale ends in
sink
in the same
way that with
is related to attach
.
capture.output(..., file = NULL, append = FALSE)
NULL
to return
the output as a character vector. If the connection is not open,
it will be opened initially and closed on exit.file
a file name or unopened
connection, append or overwrite?file = NULL
), or invisible NULL
.
file
if there is an error in evaluating the expressions, but for
file = NULL
all output will be lost.
sink
, textConnection
require(stats)
glmout <- capture.output(example(glm))
glmout[1:5]
capture.output(1+1, 2+2)
capture.output({1+1; 2+2})
## Not run:
# ## on Unix with enscript available
# ps <- pipe("enscript -o tempout.ps","w")
# capture.output(example(glm), file = ps)
# close(ps)
# ## End(Not run)
Run the code above in your browser using DataLab