Learn R Programming

drake (version 5.3.0)

output_sink_hook: An example hook argument to make() that redirects output messages to files.

Description

Most users do not need to micromanage hooks.

Usage

output_sink_hook(code)

Arguments

code

code to run to build the target.

Value

A function that you can supply to the hook argument of make().

See Also

make(), silencer_hook(), message_sink_hook()

Examples

Run this code
# NOT RUN {
test_with_dir("Quarantine side effects.", {
# Test out the output sink hook on its own.
try(
  output_sink_hook({
    cat(1234)
    stop(5678)
  }),
  silent = FALSE
)
# Create a new workflow plan.
x <- drake_plan(loud = cat(1234), bad = stop(5678))
# Run the project. Standard output (via cat() and print())
# should be suppressed, but messages should persist.
try(make(x, hook = output_sink_hook), silent = FALSE)
})
# }

Run the code above in your browser using DataLab