Learn R Programming

fakemake (version 1.11.1)

sink_all: Divert Message And Output Stream to File

Description

All output and messages up to the first error, for example thrown by stop.

Usage

sink_all(path, code)

Value

Invisibly

NULL.

Arguments

path

The path of the file to divert to.

code

The code to be executed.

Examples

Run this code
sink_path  <- file.path(tempdir(), "sink_all.txt")
sink_all(sink_path, {
         print("some output")
         warning("a warning")
         message("a message")
         print("some more output")
})
cat(readLines(sink_path), sep = "\n")

Run the code above in your browser using DataLab