sinkall {readJDX}R Documentation

Divert Both stdout and stderr to a File

Description

This is a simple utility function to direct the output of stdout and stderr to a file. stdout is the information normally printed in the console, for instance the results of print(rnorm(5)). stderr is the output created by functions message, warning and stop. The purpose of this function is to allow one to direct all this output into a single file where the results can be studied, for instance, for troubleshooting purposes. Works exactly like the base sink() function: you have to call it a second time with no arguments to close the file.

Usage

sinkall(filename = NULL)

Arguments

filename

Character. A path to a filename where the results will be captured.

Value

NULL, invisibly.

Examples

## Not run: 
tf <- tempfile(pattern = "SinkDemo", fileext = "txt")
sinkall(tf)
print("Hello")
print(rnorm(2))
print(normr(2)) # typo, so it errors
message("A message from message()")
warning("A warning from warning()")
cat("Information via cat\\n")
sinkall() # one must close the file connection
file.show(tf)

## End(Not run)


[Package readJDX version 0.6.4 Index]