This help topic is for R version 1.1. For the current version of R, try https://stat.ethz.ch/R-manual/R-patched/library/base/html/sink.html
sink {base}R Documentation

Send R Output to a File

Description

Diverts all R output to file, overwriting the file unless append is TRUE.

Usage

sink(file = NULL, append = FALSE)

Arguments

file

a character string naming the file to write to, or NULL to stop “sink”ing.

append

if TRUE, output will be appended to file; otherwise, it will overwrite the contents of file.

Details

Only prompts and error messages continue to appear on the terminal.

sink() or sink(file=NULL) ends the diversion.

Examples

sink("sink-examp.txt")
i <- 1:10
outer(i,i,"*")
sink()
unlink("sink-examp.txt")

[Package base version 1.1 ]