| sink {base} | R Documentation |
Diverts all R output to file, overwriting the file unless
append is TRUE.
sink(file = NULL, append = FALSE)
file |
a connection or 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. |
Only prompts and error messages continue to appear on the terminal.
sink() or sink(file=NULL) ends the diversion.
If file is a connection if will be opened if necessary.
Switching to another file or connection closes and destroys the
current sink connection if it is a file connection opened by the
last call to sink.
sink("sink-examp.txt")
i <- 1:10
outer(i,i,"*")
sink()
unlink("sink-examp.txt")