| 1 |
% Generated by roxygen2: do not edit by hand |
| 2 |
% Please edit documentation in R/sink.R |
| 3 |
\name{with_sink} |
| 4 |
\alias{with_sink} |
| 5 |
\alias{with_output_sink} |
| 6 |
\alias{local_output_sink} |
| 7 |
\alias{with_message_sink} |
| 8 |
\alias{local_message_sink} |
| 9 |
\title{Output redirection} |
| 10 |
\usage{ |
| 11 |
with_output_sink(new, code, append = FALSE, split = FALSE) |
| 12 |
|
| 13 |
local_output_sink( |
| 14 |
new = list(), |
| 15 |
append = FALSE, |
| 16 |
split = FALSE, |
| 17 |
.local_envir = parent.frame() |
| 18 |
) |
| 19 |
|
| 20 |
with_message_sink(new, code, append = FALSE) |
| 21 |
|
| 22 |
local_message_sink(new = list(), append = FALSE, .local_envir = parent.frame()) |
| 23 |
} |
| 24 |
\arguments{ |
| 25 |
\item{new}{\verb{[character(1)|connection]}\cr |
| 26 |
A writable \link{connection} or a character string naming the file to write |
| 27 |
to. Passing \code{NULL} will throw an error.} |
| 28 |
|
| 29 |
\item{code}{\code{[any]}\cr Code to execute in the temporary environment} |
| 30 |
|
| 31 |
\item{append}{logical. If \code{TRUE}, output will be appended to |
| 32 |
\code{file}; otherwise, it will overwrite the contents of |
| 33 |
\code{file}.} |
| 34 |
|
| 35 |
\item{split}{logical: if \code{TRUE}, output will be sent to the new |
| 36 |
sink and to the current output stream, like the Unix program \code{tee}.} |
| 37 |
|
| 38 |
\item{.local_envir}{\verb{[environment]}\cr The environment to use for scoping.} |
| 39 |
} |
| 40 |
\value{ |
| 41 |
\code{[any]}\cr The results of the evaluation of the \code{code} |
| 42 |
argument. |
| 43 |
} |
| 44 |
\description{ |
| 45 |
Temporarily divert output to a file via \code{\link[=sink]{sink()}}. For |
| 46 |
sinks of type \code{message}, an error is raised if such a sink is already |
| 47 |
active. |
| 48 |
} |
| 49 |
\seealso{ |
| 50 |
\code{\link{withr}} for examples |
| 51 |
|
| 52 |
\code{\link[=sink]{sink()}} |
| 53 |
} |